There is a kendo grid for which the transport is registered in the datasource
setDataSourceListGrid = function (obj) { var _grid = $("#MainGrid").data("kendoGrid"); var selectedRow = $(obj).closest("tr"); var selectedItem = _grid.dataItem(selectedRow); var Id = selectedItem.Id; // Этот Id отправляем на сервер dataSourceListGrid = new kendo.data.DataSource({ transport: { read: { url: "AwardHonorary/awardListGrid/", dataType: "json", type: "POST", data: { id: Id }, error: function (data) { alert("Ошибка при чтении данных."); }, complete: function (e) { } } }, pageSize: 10, serverSorting: true, serverFiltering: true, serverPaging: true, alowUnsort: true, schema: { data: function (data) { return data.List || []; }, total: "Count", model: { fields: { "field1": { editable: false, type: "int" }, "field2": { editable: false, type: "int" }, "field3": { editable: false, type: "string" }, "field4": { editable: false, type: "string" }, "field5": { editable: false, type: "string" } } } } }); return dataSourceListGrid; } Grid is registered as:
$("#awardContendersGrid").kendoGrid({ pageable: { messages: { display: "{0} - {1} из {2} элементов", empty: "Список пуст", page: "Страница", of: "из {0}", itemsPerPage: "элементов на страницу", refresh: "Обновить" } }, resizable: true, sortable: true, columnMenu: false, dataSource: setDataSourceListGrid (obj), columns: [ { field: "field1", title: "Поле1", type: "int", hidden: true }, { field: "field2", title: "Поле2", type: "int", width: "30px" }, { field: "field3", title: "Поле3", type: "string", width: "200px" }, { field: "field4", title: "Поле4", type: "string", width: "150px" }, { field: "field5", title: "Поле5", type: "string", width: "250px" }, ] }); }
On the server, the receiving method looks like this:
[HttpPost] public JsonResult Test(Int64 id, int take, int skip, int page, int pageSize, List<GridSort> sort = null) { In fidler catches the request sent by the adjac and shows the following:
id = 1 & take = 10 & skip = 0 & page = 1 & pageSize = 10 & sort% 5B0% 5D% 5Bfield% 5D = HomeAdress & sort% 5B0% 5D% 5Bdir% 5D = asc
Those. see that no serialization occurs in the json object
At the same time, the Int64 id, int take, int skip, int page, int pageSize variables come to the method on the server itself, but the sorting does not. Knowledgeable people tell me what is missing?
PS ServerSorting setting: true for kendo grid enabled