offlineStorage String|Object

The offline storage key or custom offline storage implementation.

Example - set an offline storage key

<script>
var dataSource = new kendo.data.DataSource({
    offlineStorage: "products-offline",
    transport: {
        read: {
            url: "https://demos.telerik.com/kendo-ui/service/products",
            type: "jsonp"
        }
    }
});
</script>

Example - set a custom offline storage implementation

<script>
var dataSource = new kendo.data.DataSource({
    // use sessionStorage instead of localStorage
    offlineStorage: {
        getItem: function() {
            return JSON.parse(sessionStorage.getItem("products-key"));
        },
        setItem: function(item) {
            sessionStorage.setItem("products-key", JSON.stringify(item));
        }
    },
    transport: {
        read: {
            url: "https://demos.telerik.com/kendo-ui/service/products",
            type: "jsonp"
        }
    }
});
</script>
In this article
Not finding the help you need? Improve this article