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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How sort summary column from grouped column.

Thread ID:





124884 Jul 6,2016 08:55 AM UTC Jul 19,2016 12:27 PM UTC jQuery 5
Tags: ejGrid
Oscar Montesinos
Asked On July 6, 2016 08:55 AM UTC

Hi, I've a ejGrid with 2 columns: Customer, Total amount.  Customer is grouped and I would like order Total amount by descending, it is possible?

thanks a lot
Oscar Montesinos

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On July 7, 2016 09:52 AM UTC

Hi Oscar,  

We suspect that you would like to sort the “Total Amount” column along with grouping the “Customer” column.  In the actionBegin event of Grid, push the “Total Amount” column and its sorting direction in the sortedColumns of sortSettings. When “ungrouping” the “Customer” column, “Total Amount” column splice the corresponding object from the sortSettings.sortedColumns. Refer to the following code example. 

<div id="Grid"></div> 
<script type="text/javascript"> 
    $(function () { 
            dataSource: window.gridData, 
            allowPaging: true, 
            allowSorting: true, 
            allowFiltering: true, 
            allowGrouping: true, 
            actionBegin: function (args) { 
                if (this.model.groupSettings.groupedColumns.indexOf("CustomerID") != -1) { //for grouping 
                    var cols = this.model.sortSettings.sortedColumns; 
                    if (!ej.DataManager(cols).executeLocal(new ej.Query().where("field", "equal", "Freight")).length) 
                        this.model.sortSettings.sortedColumns.push({ field: "Freight", direction: "descending" }) 
                else if (args.requestType == "ungrouping" && args.columnName == "CustomerID") { //for ungrouping 
                    var cols = this.model.sortSettings.sortedColumns; 
                    var index = cols.indexOf(ej.DataManager(cols).executeLocal(new ej.Query().where("field", "equal", "Freight"))[0]); 
                    this.model.sortSettings.sortedColumns.splice(index, 1) 
            groupSettings: { groupedColumns: ["CustomerID"] }, 
            columns: [ 
                     { field: "CustomerID", headerText: "Customer" }, 
                     { field: "Freight", headerText: "Total Amount", format: "{0:C}" } 

We have prepared a sample that can be referred from the following jsPlayground. 

Refer to the following Help Document. 

Seeni Sakthi Kumar S. 

Oscar Montesinos
Replied On July 15, 2016 12:31 PM UTC

I'm sorry, I've can reply soon, but my order problem is with summary row,  I need order by summary column in summary row like :

Grouping Customer....

Customer 1:  Total Freight: 2000$--> (I need order by this field, actually with sample order is by Customer Grouped and Freight)
Customer 2:   Total Freight: 1000$

best regards,

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On July 18, 2016 12:48 PM UTC

Hi Oscar, 

Before proceeding with your requirement, we request you to provide more and detailed information on it. In our previous update, we have provided the solution to sort the other column based on the grouping action of other column which will the sort the Grid based on the records present in the given column. Please provide following information to analyze the issue. 

1)      We have also noticed your quote, “sort summary column from grouped column”, would you like to sort the column based on the result of groupSummary as highlighted in the below code example? 


2)      Please explain the exact scenario and explain it with any picture. For instance, if you would like to sort the “Total Amount” column along with the grouping the “Customer” column, Group the “Customer” column (external action), sort the “Total Amount” column (internal action). 

Seeni Sakthi Kumar S. 

Oscar Montesinos
Replied On July 18, 2016 12:59 PM UTC

Thanks a lot, Yes to point 1), only I need to sort the column based on the result of groupSummary,

best regards

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On July 19, 2016 12:27 PM UTC

Hi Oscar, 

We could see that you would like to “Sort the column based on summary value”. As this feature is not available with our product, we have considered your requirement as feature and created a new support incident to track this. Please log on to our support website to check for further updates. 

Seeni Sakthi Kumar S. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon