I've tried to set up the sorting function by putting this
enableSorting: true,to the dataSourceSettings, but it seems every column can be applied to the sorting except the first column.
(I can click the sort icon besides each field in the column but I can't find that icon in the first column)
Further more,I don't want to show the groupingbar in my pivot table, so please help me to find a solution to make the sorting function is applied to the first column
Hi Swagger,
Through code-behind, you can use the sortSettings property to sort specific field members in ascending or descending order. Furthermore, by using the None value to the order property inside the "sortSettings" options, you can show the field members in the order as exist in the given data source. Please see the code example below.
Code Example:
|
this.dataSourceSettings = { sortSettings: [{ name: 'Country', order: 'Descending' }], };
|
Meanwhile, we have prepared a sample for your reference. Please find it from below link.
Sample: https://stackblitz.com/edit/angular-lkrl78-n5fxmx?file=app.component.ts
Kindly refer to the following document to know more details about the sortSettings.
Document: https://ej2.syncfusion.com/angular/documentation/pivotview/sorting/#member-sorting
Please let us know if you have any concerns.
Regards,
Angelin Faith Sheeba
I mean that in the picture below. Why don't we have the sort icon in the first column. Is there a possibility to have that without open the
groupingbar?
If there is, please make it works https://stackblitz.com/edit/angular-lkrl78-79qvqa?file=app.component.html
Hi Swagger,
The mentioned sort icon is used to do value sorting, and this option only works with value fields. Furthermore, the first column header you indicated is row headers, where member sorting is used to sort the data. As a result, you can sort members using either the field list or the grouping bar UI. You can also use sortSettings, which we stated in our previous update, to accomplish this member sorting in code-behind.
Please refer the below screenshot for member sorting:
Member sorting through fieldlist:
Member sorting through grouping bar:
Member sorting through code behind:
Kindly refer to the following document to know more details about the member sorting and value sorting.
Document: https://ej2.syncfusion.com/javascript/documentation/pivotview/sorting/#member-sorting
Please let us know if you have any concerns.
Regards,
Angelin Faith Sheeba