[英]prevent kendo ui grid popup editor from closing after validation errors
我从服务器返回错误并在kendo datasource错误事件中捕获它。在这个事件中我试图阻止关闭弹出编辑器,但它只是第一次工作,在第二次点击更新后,窗口一直保持关闭状态。
这是一些代码;
dataSource = new kendo.data.DataSource({
transport: {
create: function (e) {
// just posting server with ajax
InsertCity("/city/insert", e.data, function (res) {
var grid = $("#gCity").data("kendoGrid");
if (res.success) {
grid.dataSource.data(res.data);
} else {
e.error("", "", res.error);
grid.cancelChanges();
}
})
},
error: function (e) {
// after throwing error in transport/create, it comes here
var grid = $("#gCity").data("kendoGrid");
grid.one("dataBinding", function (e) {
e.preventDefault();
});
alert(e.errorThrown);
},
pageSize: 20,
schema: {
model: {
id: "ID",
fields: {
Name: { type: "string" }/*,
EndDate: { type: "date" },
CreateDate: { type: "date" }*/
}
}
}
});
$("#gCity").kendoGrid({
dataSource: dataSource,
height: 550,
selectable: "single",
filterable: true,
sortable: true,
pageable: true,
toolbar: [{ name: "new", text: "New" }],
columns: [{ field: "Name", title: "Name" }],
editable: {
mode: "popup",
confirmation: false,
template: kendo.template($("#popup_editor").html())
}
});
我搜索了很多,但找不到解决方案
尝试添加此:
var onWindowEditClose = function (e) {
debugger;
if (preventCloseOnSave) {
e.preventDefault();
preventCloseOnSave = false;
}
};
我从这里得到它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.