[英]Kendo Grid How to create a header row
I am working with AngularJs 1.5.8, ASP.NET MVC 4.0 and Kendo Grid 2016 v3.914. 我正在使用AngularJs 1.5.8,ASP.NET MVC 4.0和Kendo Grid 2016 v3.914。 I have a view with a grid on it that is grouped just fine.
我有一个带有网格的视图,该网格分组很好。
But now I need to add a row in between each group. 但是现在我需要在每个组之间添加一行。 The row will have one column but span all columns.
该行将只有一列,但将覆盖所有列。 I know what field I want.
我知道我想要哪个领域。 I just don't know how to code my controller to show the column.
我只是不知道如何编码我的控制器以显示该列。
Can you help? 你能帮我吗?
Thanks BTD 谢谢BTD
Here is me code so far. 到目前为止,这是我的代码。
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%}'
},
]
};
You can do that with a groupHeaderTemplate
. 您可以使用
groupHeaderTemplate
做到这groupHeaderTemplate
。
columns: [{
title: 'Instrument',
field: 'Instrument',
groupHeaderTemplate: "This is my dividing line...",
},
example: http://dojo.telerik.com/@sg53719/UdIxU 例如: http : //dojo.telerik.com/@sg53719/UdIxU
I answered it myself. 我自己回答了。 In my javascript controller code where I am setting the data source, I added this code group: { field: 'Name' }, and now I see the grouping.
在设置数据源的javascript控制器代码中,添加了以下代码组:{field:'Name'},现在我看到了分组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.