Kendo Grid INCELL Data loss on filter/sort/page operations

If using the incell mode to edit then anything that triggers a server request like doing a sort, filter or page change will cause it to through away all data changes and do another read and refresh it with the original data.
This means the user must save before doing this which is a big thing to ask for.
No way of trapping beforehand to request the user to save.

There turns out to be an autosync mode for the datasource.
Its not available on the MVC helper so must be done in javascript.

To do before grid initialisation use

    kendo.data.DataSource.prototype.options.autoSync = true;

but that sets the default for all datasource which is not good.
Better to do after grid init in a doc ready with

    $("#kgridA").data("kendoGrid").dataSource.options.autoSync = true;

This will cause a sync() to be done after every edit. Therefore you have the overhead of many calls to the server and the cancel button has no effect.

NOTE: When doing data updates via javascript then these wont trigger a sync so you have to call sync after any edits.

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-autoSync

Update Even though the above worked well for over a year the now much larger size made the sync that little bit slower.
I now no longer use the sync and instead use the save/cancel as normal. I had to trap the grids attempt to refresh and abort the operation with a warning to the user they should save/cancel their work before changing filters/pages etc.


Above referring to version
Telerik Kendo UI Professional Q1 2015
Telerik UI for ASP.NET MVC Q1 2015


comments powered by Disqus