Our blazing fast Grid component built with pure JavaScript


Post by pbecker »

Hi Bryntum team,

I've encountered an issue with multi-level sorting on columns with custom sort functions defined. I've included a CodePen link to test with. Any help on this would be greatly appreciated, thanks!

Expected Behavior: Applying a multi-level sort to two columns with custom sort functions should work.

Actual Behavior: Only the first level sort is applied. Even with the prioritizeColumns sorting feature enabled.

A little background: We get strings that we want to sort as numbers, so the sort function removes non-digit characters before comparing numbers.

Demo/Test Link: https://codepen.io/BeckerP86/pen/LYmOwzv
When only one column is sorted, each column sorts correctly in both directions using its sortFn defined on the column config. Where it seems to break is when a multi-sort is applied to columns with custom sorts defined.


Post by marcio »

Hey pbecker,

The column sorting is supposed to be working as one-level sorting, we have an example of multi-sorting here https://www.bryntum.com/examples/grid/sorting/ but as you'll see, we handle that programmatically with the select.

You can use beforeSort to achieve a similar behavior, and instead of replacing the current sort, merge it with the new one.

https://www.bryntum.com/docs/grid/api/Core/data/mixin/StoreSort#event-beforeSort

Best regards,
Márcio


Post by pbecker »

Hi Marcio,

Thank you for the response. My issue is not yet resolved, please see my findings below. Thanks!

I took a look at the sorting example you linked, it also demonstrates the problem I am experiencing. Here are the steps to reproduce my same problem.

1) Sort by Rank ascending.
2) Add the Age column as the 2nd sort by Ctrl+Clicking it. You can see that no matter the sort direction on Age, the 2nd sort level is never applied, even though there are multiple instances of "Rank" that are the same, that would logically allow a 2nd sort to change the order of the displayed records.

Thoughts?


Post by marcio »

Hey pbecker,

Thanks for clarifying and sharing how to reproduce that issue, it's a bug, I wrote a ticket to fix it https://github.com/bryntum/support/issues/5325

Best regards,
Márcio


Post Reply