0

Any one know if there's a way to set the chosen options unsorted when the values are integer?

I currently have a chosen to select the days of the week filled with the following JSON

[{"VAL":1,"DES":"Sunday","$$hashKey":"object:611"},
{"VAL":2,"DES":"Monday","$$hashKey":"object:612"},
{"VAL":3,"DES":"Tuesday","$$hashKey":"object:613"},
{"VAL":4,"DES":"Wednesday","$$hashKey":"object:614"},
{"VAL":5,"DES":"Thursday","$$hashKey":"object:615"},
{"VAL":6,"DES":"Friday","$$hashKey":"object:616"},
{"VAL":7,"DES":"Saturday","$$hashKey":"object:617"}]

And, when I select Wednesday first, and then Sunday, I would expect to be listed as Wednesday, Sunday ([4, 1]) instead of the sorted way, Sunday, Wednesday ([1, 4])

You can see the issue in this fiddle. Just try to select first wednesday and then monday, see how it's sorted

For better context, I'm using adityasharat angular chosen directive which uses jQuery chosen plugin

Thanks

Edit: Just for the kick of it, I tested the chosen plugin alone, and it's setting the values unsorted, as I wish them to be listed. But I can't use pure jquery, as I'm trying to stick to angular

CJLopez
  • 5,495
  • 2
  • 18
  • 30
  • Possible duplicate - [Natural Sorting in ng-options](https://stackoverflow.com/questions/18166802/how-to-use-natural-sorting-in-ng-options) – Rastalamm Jun 20 '17 at 21:05
  • @Rastalamm yeah, I don't think it's te same issue. See, I want my chosen options to be set on the chosen order, not ordered by it's value, so I can have [4, 1, 3, 2, 7, 6, 5] – CJLopez Jun 21 '17 at 14:44

0 Answers0