Posted 11 January 2022, 10:33 pm EST
Hello,
The behavior is by design. rowField columns are a little different from regular columns in that they are always sorted, either in ascending or descending order. This is different from regular columns, which are unsorted by default.
If you do not want the sort icons to appear initially then you could handle the sortedColumn event and set the property to true if the column that was sorted is not a data column.
This way, sorting on any data columns would cause the grid to show the sort icons on the data column that was sorted; sorting on the row field would show the sort over the row field only. Please refer to the code snippet below:
pivotGrid.sortedColumn.addHandler(function (s, e) {
// option 1:
// show row field sort icons when the user sorts on the row fields
// in this case, removing a data sort will *NOT* show the row field sort icons
s.showRowFieldSort = (e.panel == s.topLeftCells);
// option 2
// show row field sort icons when the data is unsorted
// in this case, removing a data sort *WILL* show the row field sort icons
// s.showRowFieldSort = s.collectionView.sortDescriptions.length == 0;
})
As you can see, there are two possible ways to handle this. The first removes the row field icons whenever the user changes the data sorts (even when they use ctrl+click to remove the data sorts). The second removes the row field icons only when the data is sorted. You can adopt any of the 2 which best suits your requirement.
Regards