我有一个Kendo网格,最初呈现为
$("#dataGrid").kendoGrid({
height: 450,
sortable: true,
columns:[
{field: "Status", title: " ", width:35},
{field: "Year", title:" ", width:50},
{field: "Name", title:" ", width:50}
],
dataSource: surveydataSource
});
我的要求是在某些函数调用中,我想更改" Name"的模板。剑道网格中的列为:
$("#dataGrid").kendoGrid({
height: 450,
sortable: true,
columns:[
{field: "Status", title: " ", width:35},
{field: "Year", title:" ", width:50},
{field: "Name", title:" ", width:50, template: "<strong>#: name # </strong>"}
],
dataSource: surveydataSource
});
有没有更简单的方法,而不是再次构建整个网格?我可以在kendo网格中更改/重置列的模板吗?
答案 0 :(得分:0)
尝试使用Kendo Grid .setOptions()方法进行设置。
var grid = $("#dataGrid").data("kendoGrid");
grid.setOptions({
columns: [
{field: "Status", title: " ", width:35},
{field: "Year", title:" ", width:50},
{field: "Name", title:" ", width:50, template: "<strong>#: name # </strong>"}
]
});