Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stable sorting in google chrome

I am using a dojo datagrid with col1 as the column with primary sorting and col2 as the secondary sorting column. After the grid loads if I again sort by col1 by clicking on the header, I can see the order of the rows getting changed randomly where the col1 has the similar values in Google Chrome . In Firefox everything seems to be working fine as they have stable sort implementation which maintains the original order of the input in case of similar key values. Is there a way I can implement some custom comparator for Array.sort() or something to avoid this problem in google chrome. Thanks in advance!

like image 708
newbie Avatar asked May 19 '26 03:05

newbie


1 Answers

It's already implemented. Give a chance to lodash function _.sortBy. It doing stable sort.

Here is docs: https://lodash.com/docs/4.17.4#sortBy

like image 88
12kb Avatar answered May 20 '26 18:05

12kb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!