This is a migrated thread and some comments may be shown as answers.

datasource update function callback

1 Answer 261 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 12 Dec 2013, 05:40 AM
I'm working on handling transport.update as a function function that writes the values to localStorage rather than a remote server.   I can't seem to get the framework to unmark the object as "dirty"... and as a result the transport.update continues to fire on every .sync() call.

I've tried all of the following approaches but the item always retains dirty = true.

manually marking dirty = false:
transport{
                update: function (options) {
                    localStorage[options.data.id] = kendo.stringify(options.data);
                    var theTask = ds.get(options.data.id);
                    theTask.dirty = false;
                    options.success(theTask);
                }
}

returning the raw data:
transport{
                update: function (options) {
                    localStorage[options.data.id] = kendo.stringify(options.data);
                    options.success(options.data);
                }
}

returning nothing:
transport{
                update: function (options) {
                    localStorage[options.data.id] = kendo.stringify(options.data);
                }
}


1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 13 Dec 2013, 08:27 AM
Hi Mark,

We have created a code-library project, showing how to create a Kendo UI DataSource using localStorage. Please check the following link, and let me know if you have any further questions:

http://www.kendoui.com/code-library/web/grid/grid-crud-using-localstorage.aspx

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Data Source
Asked by
Mark
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or