我有以下kendo网格,更新后我希望我的网格再次从数据源刷新,但不能使用以下方法我不确定是否将刷新数据源命令放在正确的位置,任何帮助将非常感谢
dataSource = new kendo.data.DataSource({
transport: {
read: function (options) {
options.success(result); // where data is the local data array
},
update: function (options) {
$.ajax({
type: "POST",
url: "/AdminTool/update_grid",
data: options.data.models[0],
dataType: "json",
success: function (data) {
options.success(data);
// alert("success");
$("#turbingrid").data("kendoGrid").dataSource.read();
},
error: function (data) {
options.error(data);
// alert("error");
},
});
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
batch:true,
pageSize: 40,
schema: {
//data: employee,
model: {
id: "DeviceIP",
fields: {
DeviceIP: { editable: false, nullable: true },
//Producer: { type:"string" },
//3 Model: { type: "string" },
DeviceType:{ type:"string" },
Description:{ type:"string" },
Username:{ type:"string" },
Password:{ type:"string" },
PublicIP: { type: "string" },
ModelProducer: { type: "string" },
TurbineId: {type:"string"}
//UnitPrice: { type: "number", validation: { required: true, min: 1} },
//Discontinued: { type: "boolean" },
//UnitsInStock: { type: "number", validation: { min: 0, required: true } }
}
}
}
});
答案 0 :(得分:1)
我用过
$("#turbingrid").data("kendoGrid").dataSource.data(data);
而不是
$("#turbingrid").data("kendoGrid").dataSource.read();
将检索到的数据加载到kendo Grid。希望能帮助到你。