Grid Server Side Filtering on multiple columns with ASP .NET Web API issues

2 posts, 0 answers
  1. EDWARD
    EDWARD avatar
    1 posts
    Member since:
    Jun 2012

    Posted 23 Jul 2012 Link to this post

    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):

    {"take":10,"skip":0,"page":1,"pageSize":10,"filter":{"filters":[{"field":"Column1","operator":"eq","value":"val1"},{"field":"Column1","operator":"eq","value":"val2"},{"logic":"or","filters":[{"field":"Column2","operator":"eq","value":5},{"field":"Column2","operator":"eq","value":1}]}],"logic":"and"},"group":[]}

    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. Eric
    Eric avatar
    19 posts
    Member since:
    Mar 2008

    Posted 08 Jul 2013 Link to this post

    Edward, I'm having the same issue here...did you ever solve this?  I should say that I can filter on multiple columns, but if I have an and/or on a single column, the filter comes through a "null"
  3. Kendo UI is VS 2017 Ready
Back to Top