Kendo ui 剑道ui内联编辑和添加新记录don';我不能以正确的方式工作
在添加新记录和编辑记录时,我们在剑道UI内联网格中遇到了一些问题。添加新记录的问题如下:当我添加一条记录时,它被添加到数据库中,但直到页面刷新后才显示在网格上;在编辑的情况下:在刷新页面之前不会进行更新。 下面您可以看到我使用的代码:Kendo ui 剑道ui内联编辑和添加新记录don';我不能以正确的方式工作,kendo-ui,kendo-grid,inline-editing,Kendo Ui,Kendo Grid,Inline Editing,在添加新记录和编辑记录时,我们在剑道UI内联网格中遇到了一些问题。添加新记录的问题如下:当我添加一条记录时,它被添加到数据库中,但直到页面刷新后才显示在网格上;在编辑的情况下:在刷新页面之前不会进行更新。 下面您可以看到我使用的代码: var crudServiceBaseUrl = window.location.href.split('?')[0]; dataSource = new kendo.data.DataSource({ transport:
var crudServiceBaseUrl = window.location.href.split('?')[0];
dataSource = new kendo.data.DataSource({
transport: {
read: {
url: crudServiceBaseUrl + "/GetList",
dataType: "json",
type: "GET",
contentType: "application/json; charset=utf-8"
},
update: {
url: crudServiceBaseUrl + "/Update",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
complete: function (e) {
$("#grid").data("kendoGrid").dataSource.read();
}
},
create: {
url: crudServiceBaseUrl + "/Create",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
complete: function (e) {
$("#grid").data("kendoGrid").dataSource.read();
}
},
parameterMap: function (options, operation) {
if (operation !== "read" && options) {
return JSON.stringify({ data: options });
}
}
},
pageSize: 20,
schema: {
data: "d",
model: {
id: "ListColId",
fields: {
ListColId: { editable: false, nullable: true, type:"number" },
ListId: {type:"number"},
ColumnTitle: { type: "string" },
DataFieldName: { type: "string" },
DataFieldId:{type:"number"},
Enabled: { type: "boolean" },
Ordering: { type: "number" },
CreatedOn: { type: "Date", editable: false }
}
},
type: 'json'
}
});
$("#grid").kendoGrid({
dataSource: dataSource,
pageable: true,
height: 550,
toolbar: ["create"],
columns: [
{field:"ListId",title:"List ID"},
{ field: "ColumnTitle", title: "Column Title", width: "120px"},
{ field: "DataFieldName", title: "Data Field name"},
{ field: "Enabled", title: "Enabled", width: "120px"},
{ field: "Ordering", title: "Order", width: "120px"},
{ field: "CreatedOn", title: "Created On", width: "120px", format: "{0:yyyy-MM-dd}"},
{ command: ["edit", "destroy"], title: " ", width: "250px" }],
editable: "inline"
});
提前谢谢你帮助我 您的服务器端代码是什么样子的?基本上,在插入一条记录之后,您必须从服务器代码返回该记录。看这个谢谢!我仔细检查了一下,结果发现网格列表在创建/更新时并没有在服务器端更新,而只是在页面加载时更新。