Mat
Mat

Reputation: 1688

Change serverFiltering option of Kendo dataSource after initialization

I'm building a Cordova app that makes extensive use of the offline support of Kendo dataSource.

Most of the dataSources are configured to use serverFiltering, but this (obviously) doesn't work if the dataSource is offline.

I'd like to change the serverFiltering option to false when the dataSource is in offline mode, as this means filtering will work (this should probably be the default functionality). Is this possible?

Upvotes: 2

Views: 354

Answers (1)

Tenza
Tenza

Reputation: 606

This answer is really late but may help others in the future. In the dataBound event of the grid, you can set the dataSource options such as serverPaging and serverFiltering like so:

$("#grid").kendoGrid({
    dataBound: function() {
        this.dataSource.options.serverFiltering = false;
    }
});

Then you can simply call the dataSource.online() method.

This article should help on how to alternate between offline/online mode in conjunction with this: https://docs.telerik.com/kendo-ui/framework/datasource/offline

Upvotes: 1

Related Questions