0
votes

I have a kendo ui grid. In my page I two button that when user click button1, I want to disable paging and disable server sorting on grid and when user click button2, I want to enable paging and server sorting.

I disable paging by this code:

$('#grid').data('kendoGrid').dataSource.pageSize(0);

and enable paging by this code:

$('#grid').data('kendoGrid').dataSource.pageSize(10);

Also I want to disable server sorting by this code:

$('#grid').data('kendoGrid').dataSource.options.serverSorting = flase;

But it does not worked. How to I do that? Thanks.

1
I really don't understand the use-case for this. Neither of these "features" is natively supported by Kendo UI. Are you trying to prevent the query string parameters from being sent on the server request?Brett

1 Answers

1
votes

The only way to make it work is to initialize a new data source and assign it to the grid:

var dataSource = new kendo.data.DataSource( 
    $.extend(grid.dataSource.options, { serverSorting: false } ) 
);

grid.setDataSource(dataSource);