Welcome to the ASP.NET MVC feedback portal. We’re happy you’re here! If you have feedback on how to improve the ASP.NET MVC, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
Hi,
if a grid has several grouped columns, the sorting does not work as expected.
E.g. in the following grid all grouped columns are sorted ascending at the initial call.
But if the column "Year" is changed from ascending to descending, the sorting is not as expected:
2021, 2018, 2019, 2020, 2022 instead of 2022, 2021, 2020, 2019, 2018
// Code example (same result when using asp.net.mvc grid instead of ej2)
let data = [
{ Year: 2018, Month: 1, Day: 1, Values: 10000 }, { Year: 2018, Month: 2, Day: 22, Values: 10200 }, { Year: 2018, Month: 3, Day: 2, Values: 10040 }, { Year: 2018, Month: 4, Day: 1, Values: 10200 }, { Year: 2019, Month: 5, Day: 4, Values: 100200 }, { Year: 2019, Month: 1, Day: 3, Values: 100030 }, { Year: 2019, Month: 2, Day: 7, Values: 1000550 }, { Year: 2019, Month: 3, Day: 6, Values: 100 }, { Year: 2020, Month: 4, Day: 25, Values: 11200 }, { Year: 2020, Month: 5, Day: 22, Values: 100200 }, { Year: 2020, Month: 1, Day: 11, Values: 1000220 }, { Year: 2020, Month: 6, Day: 12, Values: 1000330 }, { Year: 2021, Month: 4, Day: 3, Values: 1000440 }, { Year: 2021, Month: 3, Day: 4, Values: 1000440 }, { Year: 2021, Month: 1, Day: 1, Values: 10004240 }, { Year: 2021, Month: 2, Day: 14, Values: 100011110 }, { Year: 2022, Month: 11, Day: 15, Values: 10 },]
ej.grids.Grid.Inject(ej.grids.Sort, ej.grids.Group);
var grid = new ej.grids.Grid({dataSource: data,
allowGrouping: true,
allowSorting: true,
groupSettings: { columns: ['Year', 'Month', 'Day'] },columns: [
{ field: 'Year', headerText: 'Year', width: 120 }, { field: 'Month', headerText: 'Month', width: 150 }, { field: 'Day', headerText: 'Day', width: 150 }, { field: 'Values', headerText: 'Values', width: 150 }],
height: 1000
});
grid.appendTo('#grid'); var DragDropArea = $("#grid > div.e-groupdroparea.e-lib"); var dState = $(DragDropArea).css("display");if (dState !== "block")
$(DragDropArea).css({ "display": "block" });