如何从KendoUI绑定过滤器?

时间:2013-02-01 16:06:41

标签: c# asp.net-mvc

我从kendoUI获取queryString:

[0] "take"  string
[1] "skip"  string
[2] "page"  string
[3] "pageSize"  string
[4] "filter[logic]" string
[5] "filter[filters][0][value]" string
[6] "filter[filters][0][operator]"  string
[7] "filter[filters][0][field]" string
[8] "filter[filters][0][ignoreCase]"    string

模型中的这种绑定方式?

非常感兴趣的是filter[filters][0] [value]

1 个答案:

答案 0 :(得分:1)

http://www.itq.nl/blogs/post/Kendo-UI-Grid-with-server-paging-filtering-and-sorting-(with-MVC3).aspx这是我的problam的解决方案

模型:

public class SortDescription
    {
        public string field { get; set; }
        public string dir { get; set; }
    }

public class FilterContainer
    {
        public List<FilterDescription> filters { get; set; }
        public string logic { get; set; }
    }

public class FilterDescription
    {
        public string @operator { get; set; }
        public string field { get; set; }
        public string value { get; set; }
    }

数据来源:

dataSource: {
                type: "json",
                serverPaging: true,
                serverSorting: true,
                serverFiltering: true,
                allowUnsort: true,
                pageSize: 10,
                transport: { 
                    read: { 
                        url: "Export/PagedData",
                        type: "POST",
                        dataType: "json",
                        contentType: "application/json; charset=utf-8"
                    },
                    parameterMap: function(options) {
                        return JSON.stringify(options);
                    }
                },
                schema: { data: "Items", total: "TotalItemCount" }
            },