将列表分成多个列块 [英] Split list into multiple column blocks

查看:77
本文介绍了将列表分成多个列块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建页面以显示列表项,但将其分成多列以打印在一页上的请求.

The request to create a page to display the list items but split them into multiple columns to print on one page.

例如,下面是原始列表:

For example, below is the original list:

出于打印目的,需要将其分为几列,如下所示:

And for printing purposes, it needs to be split into to columns, like so:

我尝试用2个Web部件创建一个新页面,但是我不知道如何将内容分成两部分-前半部分显示在一个Web部件上,另一半显示在第二个Web部件上.它甚至不需要在SharePoint上,它可以是任何方法 只要秘书打印列表,数据就打印在一页上.

I tried creating a new page with 2 web parts but I can't figure out how to split the contents into two - first half is displayed on one web part, the other half is on the 2nd web part.  It doesn't even need to be on SharePoint, it can be any method as long as if the secretary prints the list, the data is printed on one page.

还有其他解决方法吗?非常感谢.

Any other idea to solve this? Much appreciated.

谢谢

推荐答案

我认为您可以尝试创建自定义视图并通过CSR自定义视图.

您可以通过ctx.ListData.Row获取CSR中的所有数据.

然后实施逻辑来安排数据格式.

示例代码:

(function () {
    'use strict';

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
        Templates: {
            Header: function (ctx) {
                return "<table>" +
                        "<thead>" +
                            "<tr>" +
                               "<td>FieldTitleA</td>" +
                                "<td>FieldTitleB</td>" +
                            "</tr>" +
                        "</thead>"
            },
            Body: function (ctx) {
                var data = ctx.ListData.Row;
                //the logic how you render your data.
                return "<tr><td>1</td><td>1</td></tr>";
            },
            Footer: function (ctx) {
                return "</table>";
            }
        }
    });

})();

您可以在下面的线程中查看有关CSR的详细信息.

最好的问候,


这篇关于将列表分成多个列块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆