Kendo grid change indicator and cancel not working -
i'm new kendo , kendo grid i'm trying learn how use master detail kendo grid detail grid supposed support batch editing. data available in local javascript object.
this jsfiddle demonstrates problems i'm seeing.
here's how grid being created - see jsfiddle complete snippet -
$("#grid").kendogrid({ datasource: items, detailinit: createdetail, columns: [ { field: "item", width: "200px" }, ] }); function createdetail(e) { $("<div/>") .appendto(e.detailcell) .kendogrid({ datasource: { batch:true, transport: { read: function (options) { options.success(e.data.subitems); } } }, editable:true, pageable:true, toolbar: ["save", "cancel"], columns: [ { field: "subitem", title: "sub item", width: 200 }, { field: "heading1", title: "heading 1", width: 100 } ] }); }
when edit item in grid , click next cell, details grid automatically collapses not matter click, in adjacent cell. when open again, don't see change indicator in cell (red notch) new value there. if hook save ajax call, kendo sends right detail item(s) edited.
nothing happens when click cancel changes.
how grid not collapse , see change indicators ?
how canceling of changes work correctly ?
[update] - further investigation reveals if use older kendo version 2011.3.1129 , works expected. if use newer 2012.3.1114, doesn't. dont know if bug or change in behavior.
after effort, found cause seems master grid rebinding automatically causing behavior observed. able around handling databinding event in master grid , within that, checking if of detail datasources dirty , if so, calling preventdefault.
here relevant code snippets :
databinding: function (e) { if (mastergrid.arechangespending()) { e.preventdefault(); } } arechangespending : function () { var pendingchanges = false; // gave each detail div id can "handle" $('div[id^="detail_"]').each(function (index) { var dsrc = $(this).data("kendogrid").datasource; $.each(dsrc._data, function () { if (this.dirty == true || this.isnew()) { pendingchanges = true; } }); // reason, kendo did not detect new rows in isnew() // call above, hence check below if (dsrc._data.length != dsrc._total) { pendingchanges = true; } }); return pendingchanges; }
Comments
Post a Comment