telerik kendo ui datarequest排序字段始终为null

时间:2017-07-09 10:11:55

标签: asp.net-mvc kendo-ui kendo-ui-grid

我使用telerik kendo ui grid。

<script>
        $(document).ready(function () {
            $("#grid").kendoGrid({
                dataSource: {
                    type: "POST",
                    prefix: "",
                    dataType: "json",
                    serverFiltering: true,
                    EnableCustomBinding:true,
                    transport: {
                        read: "http://localhost:51618/Home/Customers_Read"
                    },
                    pageSize: 20,
                    serverPaging: true,
                    serverFiltering: true,
                    serverSorting: true,
                    contentType: "application/json; charset=utf-8"
                },
                height: 550,
                groupable: true,
                filterable:true,
                sortable: true,
                pageable: {
                    refresh: true,
                    pageSizes: true,
                    buttonCount: 5
                },
                columns: [{
                    template: "<div class='customer-photo'" +
                                    "style='background-image: url(../content/web/Customers/#:data.CustomerID#.jpg);'></div>" +
                                "<div class='customer-name'>#: ContactName #</div>",
                    field: "ContactName",
                    title: "Contact Name",
                    width: 240
                }, {
                    field: "ContactTitle",
                    title: "Contact Title"
                }, {
                    field: "CompanyName",
                    title: "Company Name"
                }, {
                    field: "Country",
                    width: 150
                }]
            });
        });
    </script>

我的控制器是:

  public ActionResult Customers_Read([DataSourceRequest] DataSourceRequest request)
        {
// do something
}

请求发送表单网格是:

http://localhost:51618/Home/Customers_Read?take=20&skip=0&page=1&pageSize=20&sort%5B0%5D%5Bfield%5D=ContactName&sort%5B0%5D%5Bdir%5D=asc

但是datarequest排序字段始终为null。

1 个答案:

答案 0 :(得分:1)

如果你修改它 - 它应该工作(它对我有用):

Blob