Reputation: 26
Using read action I am getting grid data as json and gets binded in the grid with the title marked as bold:
Name | PRICE
XXX | 5
YYY | 10
ZZZ | 15
After binding all values, Now I have to display the grid with the title like below:
Name | PRICE(30)
XXX | 5
YYY | 10
ZZZ | 15
Is there a ClientTemplate for "Title" to do this? Instead of javascript looping and changing the title text? If so please help me.
Thanks.
Upvotes: 0
Views: 1612
Reputation: 1703
Kendo UI Grid does have headerTemplate where you can make calculation and change appearance of column header.
// Example kendoGrid use of column.headerTemplate
var templateFunction = function(shouldBeColumn) {
// shouldBeColumn is an empty object rather than the column object
return "Useless object:" + kendo.stringify(shouldBeColumn);
};
$("#grid").kendoGrid({
dataSource: {
data: products,
pageSize: 20
},
height: 550,
scrollable: true,
columns: [
{ field: "ProductName", title: "Product Name" },
{ field: "UnitPrice", title: "Unit Price", headerTemplate: plainTemplate },
{ field: "UnitsInStock", title: "Units In Stock", headerTemplate: templateFunction }
]
});
Upvotes: 0