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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to sort grid by grouped columns

Thread ID:

Created:

Updated:

Platform:

Replies:

151297 Feb 5,2020 10:40 PM UTC Feb 10,2020 03:35 PM UTC ASP.NET Core 5
loading
Tags: Grid
Neider
Asked On February 5, 2020 10:40 PM UTC

Hello, I have a grid with grouped columns and I want to sort my grid using that group. This is my grid and the code that generates it:

Code:
@{
    var GroupedCols = new List<string>() { "IdProductTransactionHeader" };
}

<ej-grid id="GridResultAllPayments" locale="@(System.Globalization.CultureInfo.CurrentCulture.Name)" allow-selection="false" allow-sorting="true" allow-grouping="true" action-complete="Complete"
         allow-filtering="true" allow-multiple-exporting="true" toolbar-click="toolbarClick1" databound="dataBound">
    <e-toolbar-settings show-toolbar="true" toolbar-items=@(new List<string>() {"excelExport" })></e-toolbar-settings>
    <e-group-settings caption-format="#captionTemplate" show-drop-area="false" show-grouped-column="false" grouped-columns="GroupedCols"></e-group-settings>
    <e-filter-settings filter-type="Excel" />
    <e-datamanager adaptor="UrlAdaptor" url="/Products/GetAllPaymentsPerProduct?idProduct=@(ViewBag.IdProduct)&idProductType=@ViewBag.IdProductType"></e-datamanager>
    <e-columns>
        <e-column field="IdProductTransactionHeader" header-text="ProductTransactionHeader"></e-column>
        <e-column field="ValueDate" header-text="@Localizer["Value date"].Value" text-align="Left" format="{0:d}" enable-group-by-format="true"
                  tooltip="@Localizer["Value date"].Value (@Bancavalor.Resources.MyResources.LocalFormatDate)"></e-column>
        <e-column field="TransactDate" header-text="@Localizer["Transact date"].Value" text-align="Left" format="{0:d}"
                  tooltip="@Localizer["Transact date"].Value (@Bancavalor.Resources.MyResources.LocalFormatDate)"></e-column>
        <e-column field="TransactAmount" header-text="@Localizer["Transaction amount"].Value" text-align="Right" format="{0:N2}"></e-column>
        <e-column field="ClientName" header-text="@Localizer["Client"].Value"></e-column>
        <e-column field="IdTransactType" header-text="@Localizer["Transact type"].Value" text-align="Left" template-id="#transTemplate" format="{0:N2}"></e-column>
        <e-column field="CreationDate" header-text="@Localizer["Creation date"].Value" text-align="Left" format="{0:@Bancavalor.Resources.MyResources.GridFormatDate}"
                  tooltip="@Localizer["Creation date"].Value (@Bancavalor.Resources.MyResources.LocalFormatDate)"></e-column>
    </e-columns>
    <e-summary-rows>
        <e-summary-row title="Total" show-caption-summary="true" show-total-summary="true">
            <e-summary-columns>
                <e-summary-column summary-type="Sum" format="{0:N2}" display-column="TransactAmount" datamember="TransactAmount" />
            </e-summary-columns>
        </e-summary-row>
    </e-summary-rows>
</ej-grid>

<script id="captionTemplate" type="text/x-jsrender">
    <div class="row col-md-12">
        <div class="col-md-6">
            {{:#data.items[0].ValueDate.toLocaleDateString("@(System.Globalization.CultureInfo.CurrentCulture.Name)")}}
        </div>
        <div class="col-md-6">
            {{:#data.items[0].TransactDate.toLocaleDateString("@(System.Globalization.CultureInfo.CurrentCulture.Name)")}}
        </div>
    </div>
</script>

So, I want to sort my grid based on the column "Fecha valor" but in a descending way, I mean first 19/11/2019 then 20/10/2019 and finally 20/9/2019, dates are format in dd-MM-yyyy.

Thanks.

Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On February 6, 2020 03:47 PM UTC

Hi Neider, 

Query#:- I have a grid with grouped columns and I want to sort my grid using that group. 

Thanks for contacting Syncfusion Support. 

We have checked your query and when we perform Grouping by default Sorting operation will take placed based on the Grouped columns. In the below example, we have grouped the columns with format dd-MM-YYYY, Sorting has been worked based on that. In the below example, OrderDate  has been Grouped with sorted order as like(22/10) and (18/02) 
Refer to the screenshot:- 
 
Refer to the sample Link:- 

If we misunderstood your query, please get back to us with further details. 

Regards, 
Farveen sulthana T 


Neider
Replied On February 6, 2020 04:20 PM UTC

Thanks for the answer but I can't download it, it says to me "Access denied".

Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On February 7, 2020 12:38 PM UTC

Hi Neider, 

Sorry for the inconvenience caused. 

We have reattached the sample again. Please check this sample and let us know the details. 


Regards, 
Farveen sulthana T 




Neider
Replied On February 7, 2020 02:11 PM UTC

I already checked it but I want to sort it in a descending way (from recent dates to old dates), in the example that you show me the grid is sorted ascendingly (look the years). Thanks

Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On February 10, 2020 03:35 PM UTC

Hi Neider,  

We have prepared sample with Grouped column with sorted order “Descending” by default but the values are sorted on Descending with Month (22/10/1991) ,(15/5/1991) and (04/04/1991) 

Refer to the sample Link:- 

Refer to the screenshot:- 

 

If your requirement is different from above, please get back to us with further details. 

Regards, 
Farveen sulthana T 


CONFIRMATION

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

Live Chat Icon For mobile
Live Chat Icon