New to Kendo UI for jQueryStart a free 30-day trial

Gets or sets the offline state of the data source.

Parameters:dataArray

The array of data items that replace the current offline state of the data source.

Returns:Array

—An array of JavaScript objects that represent the data items. Changed data items have a __state__ field attached. That field indicates the type of change: "create", "update", or "destroy". Unmodified data items do not have a __state__ field.

<script>
var dataSource = new kendo.data.DataSource({
    offlineStorage: "products-offline",
    transport: {
        read: {
            url: "https://demos.telerik.com/service/v2/core/products"
        },
        update: {
            url: "https://demos.telerik.com/service/v2/core/products/update",
            type: "POST",
            contentType: "application/json"
        },
        parameterMap: function(options, operation) {
            if (operation !== "read" && options.models) {
                return kendo.stringify(options.models);
            }
        }
    },
    schema: {
        model: {
            id: "ProductID"
        }
    }
});

dataSource.fetch(function() {
    // go in offline mode
    dataSource.online(false);
    // change the ProductName field of the first data item
    dataSource.at(0).set("ProductName", "Updated");
    // sync to accept the changes
    dataSource.sync();
    // get the offline data
    var offlineData = dataSource.offlineData();
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(offlineData[0].__state__); // displays "update"
});
</script>
Not finding the help you need?
Contact Support