0
votes

I have a kendo grid with Server side pagination enabled to avoid the performance issue. I have made the .SeverOperation(True) which means that the data will be loaded part by part as i click on pagination button in the grid.

In my case PageSize(20), each time i click next pagination button, next set of 20 records will be loaded.

Now, I want to implement Server Filtering. First time, this loads by hitting the server. So, if i filter for one value "Number = 123", and my result has 40 records, then my grid will be having 2 pages. But if i click on 2nd page, this again hits the server and DataSource.Request.Filter will be null.

Any idea, how to retain the FilterColumns or how to enable client side filtering when server side filtering is enabled?

Thanks,

1
ServerOperation(true) will call the server each time you change page. If you want to filter on client side only, you must have this as false. You should send you filter to the server, fetch the filtered records, and on the client you already have your set of records filtered, and can change pages seamlesslychiapa
@chiapa : Yes, I understood that ServerOperation(false) will be for client side. But i need Filter at server side and each time i want to pass my filter to the server side. As you said "You should send you filter to the server, fetch the filtered records", please let me know how can i send my filter each time i click on pagination button. Now, i am losing that filter when i click on pagination button. Hope i am clear to you.Lak
The only answear for your question for now is: "you have done something wrong, you should get filter object when you filter values and then change page". I've just check telerik mvc "Grid/Filter Row" demo. I filtered column, changed page and I still get filter object in request object. You need to give us more information or/and code example if you want help. PS. You can't have server pagination and client filter out of the box.Jarosław Kończak
Hi, i think i got the route cause. This was because of our customized framework.To get the filter I have written the following Code on Read method. .DataSource(dataSource => dataSource.Ajax() .Read(read => read.Action("LoadGridData", ControllerName).Data("get")).ServerOperation(true) function get(){ var grid = $("#Grid").data("kendoGrid"), parameterMap = grid.dataSource.transport.parameterMap; var data = parameterMap({ filter: grid.dataSource.filter() }); return { grid: data } } In Controller i am not sure which type is "grid" parameter?Lak

1 Answers

0
votes

I was also facing with same problem and one solution on it that just add your filter parameter in parameterMap like this,

parameterMap: function (options) {
                        options.DivisionId = $("#division").val();
                        return JSON.stringify(options);
                    }

This gives me filter value on server side