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.