Enable both client and server-side filtering in Kendo UI

3 posts, 1 answers
  1. Joakim
    Joakim  avatar
    2 posts
    Member since:
    Jun 2013

    Posted 24 Jun 2013 Link to this post

    I have stumbled upon a problem using Kendo UI with ASP.NET MVC Wrappers. I am applying intial filters in a extension method on GridBuilder like this:

    public static GridBuilder<T> Test<T>(this GridBuilder<T> builder)
    where T : class
    {
    var filters = new List<IFilterDescriptor>();
    filters.Add(//adding my filters)

    return builder.DataSource(s => s.Server().Filter(f => f.AddRange(filters)));
    }

    The problem appears when I for example sort a specific column and Kendo creates its query string:

    ?Grid-sort=FName-desc&Grid-page=1&Grid-pageSize=10&Grid-group=&Grid-filter=

    What happens is that Grid-filter= overrides my intial filters causing them to not be applied anymore. The exception is when i apply one of my own filters before Kendo creates its query string, then my filter gets added to the query string and everything is fine and dandy.

    Is there a way to prevent Kendo from overriding my intial filters?

    Thanks in advance.
  2. Answer
    Daniel
    Admin
    Daniel avatar
    2219 posts

    Posted 26 Jun 2013 Link to this post

    Hello Joakim,

    Setting the initial state is not supported when using server binding because there is no way to determine if the values are sent as part of the request or are set through the configuration. You should use Ajax binding in order to set predefined filters.

    Regards,
    Daniel
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Joakim
    Joakim  avatar
    2 posts
    Member since:
    Jun 2013

    Posted 26 Jun 2013 Link to this post

    That's what I expected, problem was solved by re-applying the filters with javascript.
    //Joakim Thun
Back to Top