How do you pass client-side filters to the server?

2 posts, 0 answers
  1. Ryan
    Ryan avatar
    3 posts
    Member since:
    May 2019

    Posted 27 Jun 2019 Link to this post

         I've got a bunch of methods client-side that build up a list of all the filters to apply to a grid. However, I'm told it is possible to pass this list over to the server in order to have better control over the filters? In my case, I am trying to create a filter that looks like this:

    `(cond || cond || cond) && cond`

    I've noticed that Kendo seems to only support cases where it is `cond || cond` or `cond && cond`. Unless there is a way to make the above condition work, how can I pass my filters to the server and the `DataSourceRequest` in order to have that further control?

  2. Georgi
    Georgi avatar
    685 posts

    Posted 01 Jul 2019 Link to this post

    Hi Ryan,

    You could create the `(cond || cond || cond) && cond` filter as follows:

    var filter = {
        {field:'...', operator:'...', value: '...'},
          logic:'or', filters:
            {field:'...', operator:'...', value: '...'},
            {field:'...', operator:'...', value: '...'},
            {field:'...', operator:'...', value: '...'}

    Furthermore, you can submit this filter to the server using the dataSource.filter method.



    Have in mind that server operations should be enabled (by default they are enabled with Ajax binding), otherwise the grid will filter the data on the client and omit submitting the request to the server.

    I hope this answers your questions.

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top