gpt4 book ai didi

javascript - 添加行后编辑时剑道网格行消失

转载 作者:行者123 更新时间:2023-12-03 00:28:26 25 4
gpt4 key购买 nike

我定义了一个像这样的剑道网格,不知何故在添加一行后,我所做的第一次编辑单击(在发送到服务器之前)我刚刚添加的行消失了,刷新后它仍然存在。有什么建议为什么会发生吗?

$("#actionGrid").kendoGrid({          
scrollable: true,
height: "200px",
toolbar: [{name: "create", text: "Add"}],
editable: {
mode: "inline",
confirmation: false
},
columns: [
{ field: "order", title: "Order", width: 80 },
{ field: "action", title: "Action name"},
{ command: ["edit", "destroy"], width: 100 }
],
dataSource: {
schema: {
model: {
id:"taskId",
fields: {
taskId: { type:"number" },
order: { type: "number", validation: { min: 0 } },
action: {}
}
}
},
transport: {
read: {
dataType: "json",
type: "GET",
contentType: "application/json",
url: "action/readByPId?pId=" + pId
},
destroy: {
dataType:"json",
type:"POST",
contentType:"application/json",
url: "action/delete"
},
update: {
dataType: "json",
type: "POST",
contentType: "application/json",
url: "action/update"
},
create: {
dataType: "json",
type: "POST",
contentType: "application/json",
url: "action/update"
},
parameterMap:function parameterMap(options,type) {
if(type !== "read"){
return JSON.stringify(options);
}
}
},
sort: { field: "order", dir: "asc" }
}
});

最佳答案

Kendo Grid 有直接的规则。就像每当创建新记录时,必须将更新的列表返回给客户端调用。请确保更新的记录是否返回。

如果您使用kendo UI的在线离线功能。然后按照下面的演示进行操作。 https://demos.telerik.com/kendo-ui/grid/offline

你没有提到数据通信方式。但如果您采用纯粹的自定义方式,那么您必须在执行任何操作后更新数据源。请输入以下代码以使用新数据进行更新。

$('#GridName').data('kendoGrid').dataSource.read(); <!--  first reload data source -->

$('#GridName').data('kendoGrid').refresh(); <!-- refresh current UI -->

关于javascript - 添加行后编辑时剑道网格行消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53978479/

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