The sort order of groups on the kendo ui network

Here I wrote a stored procedure for getting CategoryName values โ€‹โ€‹based on id. The values โ€‹โ€‹come like India, America, Brazil before serving. But in the user interface section, the values โ€‹โ€‹are automatically sorted alphabetically, displaying groups such as America, Brazil, India. I wanted to show how in the display, for example, in India, America, Brazil. What am I doing wrong? Thanks in advance.

$(document).ready(function () { var grid = $("#grid").kendoGrid({ dataSource: { type: "GET", transport: { read: { url: "some url placed here", dataType: "jsonp" } }, pageSize: 20, serverSorting: false, group: { field: "CategoryName", aggregates: [{ field: "abc", aggregate: "count" }, { field: "def", aggregate: "sum" }, { field: "ghi", aggregate: "sum" }] }, aggregate: [{ field: "abc", aggregate: "count" }, { field: "def", aggregate: "sum" }, { field: "ghi", aggregate: "sum" }] }, columns: [ //column section goes here..... ], sortable: false //... }); 

});

+4
source share
3 answers

I remember somewhere in the ui kendo documentation (maybe datasource> groups) he said that if you define groups, sorted data is required for grouping. Delete all your groups and show the data in a simple vanilla grill and see if some automatic sorting is applied.

+1
source

This is a complete hunch, but have you tried setting the ServerSorting property to true?

0
source

Kendo UI Grid Grouping gives you ListSortDirection.Ascending default sorting. If you want to do something else, you must install it. If you use the WebApi interface and generate kendoRequest for the Kendo.mvc.dll method .ToDataSourceResult(kendoRequest); you can try something like this:

 var sort = kendoRequest.Sorts.FirstOrDefault(); var group = kendoRequest.Groups.FirstOrDefault(); if(sort != null && group != null) { if(sort.Member == group.Member && sort.SortDirection == ListSortDirection.Descending) { kendoRequest.Groups[0].SortDirection = sort.SortDirection; } } 

Thus, the Sort from grid function affects a group by column when they match.

0
source

All Articles