Filter kendo grid from Query string parameters

2 posts, 0 answers
  1. Aktzc
    Aktzc avatar
    6 posts
    Member since:
    Jul 2012

    Posted 24 Jul 2014 Link to this post

    Hi I have a kendo grid with server sorting, server filtering, server paging functionalities. Is there a way, where I can filter the grid from querystring parameters. Example:

    I have a kendo grid with First name, Last Name, Address etc columns. Now I have the following url:(the query string will be dynamic)


    Can we filter the grid based on the given query string? Also, can we save the state after filtering the grid and load it once this url is clicked again?

    Any help appreciated!! THANKS
  2. Alexander Valchev
    Alexander Valchev avatar
    2887 posts

    Posted 28 Jul 2014 Link to this post

    Hello Aktzc,

    Generally speaking this is possible, but you will have to write custom JavaScript logic that parses the query string parameters into filter rules (e.g. JavaScript objects). For example:

    //should be transformed into
      { field: "fname", operator: "eq", value: "tom" },
      { field: "lname", operator: "eq", value: "William" }

    Once the filter rules array is build, you should pass it to the filter method of the DataSource.

    Regarding the saving grid's state question, I suggest checking this code library project as it demonstrates how to save the Grid's state in a cookie and restore it when the page is opened again.

    Alexander Valchev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top