gpt4 book ai didi

javascript - 更新后刷新网格不起作用

转载 作者:行者123 更新时间:2023-11-30 21:14:03 25 4
gpt4 key购买 nike

我有以下剑道网格,更新后我希望从数据源再次刷新我的网格,但不适用于以下方法我不确定我是否将刷新数据源命令放在正确的位置,任何帮助都会受到高度赞赏

 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 } }
}
}
}


});

最佳答案

我用过

$("#turbingrid").data("kendoGrid").dataSource.data(data);

代替

$("#turbingrid").data("kendoGrid").dataSource.read();

将检索到的数据加载到剑道网格。希望能帮助到你。

关于javascript - 更新后刷新网格不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45860557/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com