Kendo Grid如何创建标题行

时间:2017-01-13 20:10:21

标签: javascript angularjs asp.net-mvc

我正在使用AngularJs 1.5.8,ASP.NET MVC 4.0和Kendo Grid 2016 v3.914。 我有一个带有网格的视图,它被分组很好。

但是现在我需要在每个组之间添加一行。该行将包含一列但跨越所有列。我知道我想要什么领域。 我只是不知道如何编码我的控制器来显示列。

你能帮忙吗?

由于 BTD

到目前为止,这是我的代码。

            return {
                toolbar: ["excel", "pdf", { name: "exportCSV", template: "<a class='k-button k-button-iicontext k-grid-exportCSV' ng-click='vm.currentRatesKendoGridToCSV(vm.rateType)'><span class='glyphicon glyphicon-list-alt'></span> Export to CSV</a>" }],
                excel: { fileName: "AdvanceRates.xlsx", allPages: true },
                pdf: {
                    avoidLinks: true,
                    allPages: true,
                    fileName: "AdvanceRates.pdf"
                },
                group: [{ field: 'ParentName' }, { field: 'Id' }, { field: 'SortBy' }, { field: 'Name' }],
                //group: { field: 'ParentName','Id','SortBy','Name', aggregates: [ { field: "Name"}] },
                sortable: false,
                filterable: false,
                columns: [
                        {
                            title: 'Instrument',
                            field: 'Instrument',
                        },
                        {
                            title: 'Rate',
                            field: 'Rate',
                            format: '{0:0.000%}'
                        },
                ]
            };

2 个答案:

答案 0 :(得分:2)

您可以使用groupHeaderTemplate

执行此操作
columns: [{
              title: 'Instrument',
              field: 'Instrument',
              groupHeaderTemplate: "This is my dividing line...",
          },

示例:http://dojo.telerik.com/@sg53719/UdIxU

答案 1 :(得分:0)

我自己回答了。 在我设置数据源的javascript控制器代码中,我添加了以下代码组:{field:'Name'},现在我看到了分组。