Posted 11 September 2019, 12:15 pm EST
I am using Wijmo Flexgrid in my Angular6 application. I want to sort only certain columns in my flexgrid.
Any pointers on how to do this would be appreciated.
Forums Home / Wijmo / General Discussion
Posted by: Pramod.Nair on 11 September 2019, 12:15 pm EST
Posted 11 September 2019, 12:15 pm EST
I am using Wijmo Flexgrid in my Angular6 application. I want to sort only certain columns in my flexgrid.
Any pointers on how to do this would be appreciated.
Posted 11 September 2019, 2:48 pm EST
Hi,
To avoid sorting of some columns, you may handle the FlexGrid’s sortingColumn event and use the cancel property to prevent the sorting. Please refer to the code snippet and the sample below:
private _noSortColumns = ['id', 'date', 'amount'];
onSortingColumn(s, e) {
let binding = s.columns[e.col].binding;
e.cancel = this._noSortColumns.indexOf(binding) >= 0;
}
https://stackblitz.com/edit/angular-dxen6r
In this sample, observe that the ‘id’, ‘date’ and ‘amount’ column cannot be sorted.
Regards,
Ashwin
Posted 12 September 2019, 4:45 pm EST
That worked. Thank you Ashwin
Posted 12 September 2019, 5:21 pm EST
Hi,
Glad to be able to help. Let us know if you face any other issues.
~regards