This is a migrated thread and some comments may be shown as answers.
Grid Server Side Filtering on multiple columns with ASP .NET Web API issues
1 Answer 113 Views
This is a migrated thread and some comments may be shown as answers.
EDWARD
Top achievements
Rank 1
EDWARD asked on 23 Jul 2012, 05:58 PM
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.

1 Answer, 1 is accepted

Sort by
0
Eric
Top achievements
Rank 1
answered on 08 Jul 2013, 02:40 PM
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"
Tags
Grid
Asked by
EDWARD
Top achievements
Rank 1
Answers by
Eric
Top achievements
Rank 1
Share this question
or