Kendo Grid - Server Filtering with Multiple columns

2 posts, 0 answers
  1. Ebony
    Ebony avatar
    1 posts
    Member since:
    May 2015

    Posted 25 May 2016 Link to this post

    I copied this from a post in made in 2012.  This is exactly what is happening in my application.  Any pointers on how to get around it?  Everything works fine until I try to filter on more than one column. 

    I am trying to implement server side filtering using the Kendo UI Grid and ASP .NET Web API RC.  It works fine with one column, but when the user filters on a second column issues occur.  The values for the second column seem to be included in the array of values for column one.  How can I parse this on the server?

    I am including the JSON format of the data being passed to the server because it is easier to read.  Normally I have to pass the values in the query string.  If the JSON format could be used that would be better (so let me know if anyone knows how):


    Here are the c# objects for the mapping that I found online that currently only works with one column.  PageListArguments is the object that is used as the input parameter for the Get function of the Web API Controller.

        public class GridFilter
            public string Field { get; set; }
            public string Operator { get; set; }
            public string Value { get; set; }

        public class GridFilters
            public List<GridFilter> Filters { get; set; }
            public string Logic { get; set; }

        public class GridSort
            public string Field { get; set; }
            public string Dir { get; set; }

        public class PageListArguments
            public int Take { get; set; }
            public int Skip { get; set; }
            public int Page { get; set; }
            public int PageSize { get; set; }
            public string Group { get; set; }
            public List<GridSort> Sort { get; set; }
            public GridFilters Filter { get; set; }

    Everything parses fine except for the filter when more than one column is used.

  2. Dimiter Topalov
    Dimiter Topalov avatar
    1292 posts

    Posted 27 May 2016 Link to this post

    Hello Ebony,

    I have already answered in Ticket ID: 1037717, but I will also post here, so others might benefit as well:

    Please check out the following how-to article from our documentation:

    ... or the WebApi Grid demo from the sample application, available with your installation package.

    Note that a special model binder for the request has to be used:

    public DataSourceResult Get([System.Web.Http.ModelBinding.ModelBinder(typeof(WebApiDataSourceRequestModelBinder))]DataSourceRequest request)
        return service.Read().ToDataSourceResult(request);

    I hope this helps, but if applying the necessary adjustments to your implementation does not solve the problem, please send us an isolated runnable project, demonstrating the issue, so we can investigate it further.

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