我知道剑道数据源中触发了哪些事件,但我想知道是否有人列出了事件触发的顺序。我试图在 read() 和 refresh() 之后重新过滤网格,但似乎无法使代码正常工作。它通过更改事件保存得很好,但我不知道在哪里实际尝试将过滤器插入到网格中,因此它将像保存之前一样被过滤
dataSource: {
type: "json",
serverSorting: false,
batch: true,
pageSize: 50,
change: function(e) {
dataSource = $("#grid").data("kendoGrid").dataSource;
saveFilters = dataSource.filter();
sessionStorage.setItem('theGridFilters', JSON.stringify(saveFilters));
console.log("save: " + JSON.stringify(saveFilters) );
},
transport: {
read: {
url: "./grid_projectselections.php?delob=" + escape(lob),
dataType: "json",
cache: false,
complete: function () {
}
},
update: {
url: "./update_projectselections.php?delob=" + escape(lob),
dataType: "json",
complete: function () {
$("#grid").data("kendoGrid").dataSource.read();
$("#grid").data("kendoGrid").refresh();
}
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
}
},
requestEnd: function(e) {
if (e.type != undefined ) {
if ( e.type === 'read' ) {
hidesavingpanel();
}
}
},
schema: {
data: "data",
total: "total",
model: {
id: "RowID",
fields: {
RowID: {editable: false},
ProjectID: {editable: false},
ProjectName: {editable: true},
HostCount: {editable: false},
HR_LEVEL_5: {editable: false},
HR_LEVEL_6: {editable: false},
HR_LEVEL_7: {editable: false},
HR_LEVEL_8: {editable: false},
HR_LEVEL_9: {editable: false},
OrgDescr: {editable: false},
GroupDescr: {editable: false},
RegionDescr: {editable: false},
SectionDescr: {editable: false}
}
}
},
},
saveChanges: function(e) {
var g = $('#grid').data('kendoGrid');
var data = g.dataSource.view();
var isdirty = false;
$.each(data, function (i, item) {
if (item.dirty) {
isdirty = true;
}
});
if ( isdirty === false ) {
return true;
}
showsavingpanel();
},