Posted 14 September 2021, 8:20 pm EST - Updated 3 October 2022, 3:30 am EST
Hi team,
Below solution was provided for disabling the sorting on header click.
grid.hostElement.addEventListener(
'click',
e => {
if (e.target.classList.contains('wj-state-active')) {
grid.startEditing();
var selection = window.getSelection();
selection.collapseToEnd();
}
let ht = grid.hitTest(e);
if (
e.target.classList.contains('wj-header') &&
ht.cellType == wjGrid.CellType.ColumnHeader
) {
e.preventDefault();
e.stopImmediatePropagation();
}
},
true
);
Refer line ( 301 to 320)
Snippet :- https://stackblitz.com/edit/angular-wcumux?file=src/app/app.component.ts
But if you see in the gif attached below even though we have disabled sorting on header click but if we continuously click on the header it gets sorted and this behavior is more prominent in our case because as we navigate from different pages we end up getting sorting done by header click .
How can we remove sorting from header ?
PS: Sorting should only be done using the sorting icon provided.
Please provide solution.
Regards.