我有剑道网格列如下:复位剑道网格列
$("#lstCategory").kendoGrid({
dataSource: {
data: info,
autoSync: true,
schema: {
model: {
fields: {
category: { editable: false, type: "string" },
subCategory: { editable: false, type: "string" }
}
}
},
pageSize: 7,
group: {
field: "category",
aggregates: [
{ field: "category", aggregate: "count" }
]
}
},
sortable: true,
scrollable: false,
pageable: true,
editable: true,
columns: [
{ field: "category", title: "Categoría", aggregates: ["count"], groupFooterTemplate: "Total: #=count#" },
{ field: "subCategory", title: "Subcategoria" },
{ command: "destroy", title: "", width: "150px" }
]
});
}
有我添加字段后采取行动。问题是,我想后之后,该网格重置刷新它并插入另一值我尝试使用下一个命令:
$("#lstCategory").empty(); // this one dissapear kendo grid
$('#lstCategory').data('kendoGrid').refresh();
$('#lstCategory').data().kendoGrid.destroy();
但他们没有冲洗后后,我的剑道,有什么可以是问题吗?
更新:
尝试为恐惧海盗回答:
后的行动后,我送这样的:
var grid = $("#lstCategory").getKendoGrid();
var info = refeshInfoFromServer();
grid.dataSource.data(info);
function refeshInfoFromServer() {
return $("#lstCategory").data("kendoGrid").dataSource.read();
}
这似乎是工作,但我的网页会卡在装载。 Google Chrome Inspector返回
kendo.all.min.js:11 Uncaught TypeError: e.slice is not a function
片引发错误。您需要定义数据来自哪些属性。如果您没有指定它使用某个默认值。 http://docs.telerik.com/kendo-ui/api/javascript/data/datasource – Ademar
这不是我所建议的......你需要重新填充服务器中的信息*但是你第一次使用它*。没有办法info = grid.dataSource.read(),因为read()方法返回一个Promise * not *数据。所以,你现在正在做的是将dataSource的数据设置为Promise ...,它甚至不能远程工作,这就是为什么你得到了切片错误......当切片在Promise上被调用时而不是合法的数据阵列。您需要向我们展示信息是如何填充的。 –