We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to group a column and put in descending order as default?


I'm using the grid and doing the initial grouping of the "Date" column, but I would like the default to be descending. How to adjust it?


    <ejs-grid id="GridProducaoEstoque"













            <e-data-manager url="/EstoqueMovimenta/UrlDataSource"




            <e-grid-groupsettings columns="@(new string[] {"datamovimenta"})" allowReordering="true"></e-grid-groupsettings>

3 Replies

RS Rajapandiyan Settu Syncfusion Team November 22, 2022 04:48 AM

Hi Roberto,

Thanks for contacting Syncfusion support.

To group the columns in descending order at initial render, we suggest you to sort that columns in descending order in the initial settings of Grid to achieve your requirement.

Initial Sort: https://ej2.syncfusion.com/documentation/grid/sorting/#initial-sort




    List<object> cols = new List<object>();

    cols.Add(new { field = "TrackedDate", direction = "Descending" });



<ejs-grid height="273" id="GridProducaoEstoque" created="created">

    <e-grid-sortsettings columns="cols"></e-grid-sortsettings>

    <e-grid-groupsettings columns="@(new string[] {"TrackedDate"})" allowReordering="true"></e-grid-groupsettings>



If you want to Group the columns in descending order after the initial rendering, you can achieve this by overriding the following method in the created event of Grid.

Created: https://ej2.syncfusion.com/javascript/documentation/api/grid/#created


    function created(args) {

        this.groupModule.groupAddSortingQuery = function (colName) {

            let i = 0;

            while (i < this.parent.sortSettings.columns.length) {

                if (this.parent.sortSettings.columns[i].field === colName) {





            if (this.parent.sortSettings.columns.length === i) {


                    field: colName,

                    direction: 'Descending',

                    isFromGroup: true,


            } else if (!this.parent.allowSorting) {

                this.parent.sortSettings.columns[i].direction = 'Descending';





Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/core_grid_url_group_descending1607892936.zip


Rajapandiyan S

RO Roberto November 23, 2022 05:33 AM


It´s working.


RS Rajapandiyan Settu Syncfusion Team November 23, 2022 10:17 PM

Hi Roberto,

We are happy to hear that you have achieved your requirement with the solution provided.

Please get back to us if you need further assistance.


Rajapandiyan S

Live Chat Icon For mobile
Up arrow icon