Wrong sorting in Juce Demo


#1

I noticed that the when sorting (clicking on header) the Ratings column of the Tables widget demo, the results were wrong. Other columns are sorted correctly. Is that an intended behaviour ?


#2

Oh, probably just a typo in my demo code that compares that particular column. I very much doubt that it'll be a bug in the table itself.


#3

Well in fact it is due to the sorting being based on the indexes in the combobox item list instead of their alphabetical order. No big deal but it is confusing from a user standpoint since all other columns are sorted in alphabetical order.  


#4

An easy way to fix that is to change the indexes in RatingColumnCustomComponent method:

            comboBox.addItem ("fab", 1);
            comboBox.addItem ("groovy", 2);
            comboBox.addItem ("hep", 3);
            comboBox.addItem ("neat", 4);
            comboBox.addItem ("wild", 7);
            comboBox.addItem ("swingin", 6);
            comboBox.addItem ("mad for it", 5);

Another (better ?) way would be to generate those indexes automatically based on the item String names. Now this is of course if you want to sort them in that order. But since in the demo everything is sorted that way...


#5

Thanks - I'll tweak it so that the order of the items is correct, just to avoid confusion.