1
votes

I have a Telerik MVC grid which uses custom binding. Using javascript I store the filter, page and grouping in a cookie, such that when the user reloads the page, the filtering etc. is restored:

$(document).ready(function () {
   //restore previously saved filters
    var params = $.deparam($.cookie("MyGridCookie"));
    var grid = $("#MyGrid").data("tGrid");
    var refresh = false;
    if (params.filterBy && params.filterBy != "") { grid.filterBy = params.filterBy; refresh = true; }
    if (params.currentPage && params.currentPage != 1) { grid.currentPage = params.currentPage; refresh = true; }
    if (params.orderBy && params.orderBy != "") { grid.orderBy = params.orderBy; refresh = true; }
    if (refresh) grid.ajaxRequest();
});

I've used the exact same code for grids without custom binding and this works just fine. However, in this particular case, the parameter command.FilterDescriptors is empty. But when I manually input the same filter which is stored in the cookie, the filtering works just fine.

So apparently, when custom binding is enabled, the telerik grid does something different when it comes to filtering compared to a grid without custom binding. Does anyone know how to resolve this issue?

2
did you find solution to your problemJohn x
I haven't checked it yet as I've just returned from holiday, but a colleague of mine has looked at it and said it had to do with telerik putting the information in the property CompositeFilterDescriptorsPieter
Which version did you work on it ??Wahid Bitar

2 Answers

0
votes

Indeed the problem was with the filters being stored in CompositeFilterDescriptors. Problem solved.

0
votes

Did you try grid.rebind(); instead of grid.ajaxRequest();