You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
I have a selectize dropdown with numeric entries from 1 to 31 (i.e. days in month) created from the original select element. Options are sorted correctly in Firefox but incorrectly in Chrome.
I can confirm incorrect behaviour when using this jsfiddle. In Chromium browser I always got options sorted like [7, 1, 3, 4, 5, 6, 2, 8, 9, 10, 11, 12], but in Firefox options are sorted from 1 to 12.
I'm having a similar issue. Selectize doesn't use the order of my Array of Objects that is passed from my Web Service. Does anyone knows how to solve this issue? The filter option is not enabled btw.
I am experiencing this issue using 0.8.5. It's a fairly serious problem, as users kind of expect days of the month to be linear. The jsfiddle above is using 0.8.4 and exhibits the same behavior I see in 0.8.5.
For any other lost pilgrims who have been fighting this issue...
When setting selectize on an element, if you can provide the data in the desired order, the sort can be disabled by setting 'sortField: []' in the properties. This will prevent your options from being mis-ordered in Chrome.
I have the same issue; elements are totally out of order in Google Chrome 39 but are in order in Safari 8 beta. Using Selectize 0.11. The fix was to use sortField: []. Not sure why that works, but it does.
It looks like this is still an issue. I've just forked the repo and get the same issue when remotely retrieving data. Options are placed into an associative array indexed by their id. This fundamentally reorders them. Applying no sortField or a sortField of [] doesn't work for me. What I've looked to do is re-assign the $order property that is the default sort property. This usually looks at non-dynamic data without ids (i.e. html option tags) and assigns it as an incremental index. I overwrite this for dynamic data and so if no sortField is specified it falls back to the $order property and works correctly
Activity
brianreavis commentedon Dec 5, 2013
Can you provide a jsfiddle that reproduces this problem? There is a test in place for this, so I'm curious what's going on...
ifsred commentedon Dec 10, 2013
I can confirm incorrect behaviour when using this jsfiddle. In Chromium browser I always got options sorted like [7, 1, 3, 4, 5, 6, 2, 8, 9, 10, 11, 12], but in Firefox options are sorted from 1 to 12.
eliashdezr commentedon Dec 10, 2013
I'm having a similar issue. Selectize doesn't use the order of my Array of Objects that is passed from my Web Service. Does anyone knows how to solve this issue? The filter option is not enabled btw.
sluukkonen commentedon Dec 11, 2013
I had this problem with 0.7.7, but upgrading to 0.8.5 fixed it for me.
mysterfitz commentedon Mar 4, 2014
I am experiencing this issue using 0.8.5. It's a fairly serious problem, as users kind of expect days of the month to be linear. The jsfiddle above is using 0.8.4 and exhibits the same behavior I see in 0.8.5.
mysterfitz commentedon Mar 5, 2014
For any other lost pilgrims who have been fighting this issue...
When setting selectize on an element, if you can provide the data in the desired order, the sort can be disabled by setting 'sortField: []' in the properties. This will prevent your options from being mis-ordered in Chrome.
vemv commentedon Mar 10, 2014
sortField: []doesn't work for me unfortunately.enoshixi commentedon Mar 10, 2014
The problem is that ECMAScript standard does not guarantee Array.sort is a stable sort (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description).
If you have a value you can sort by, you can always specify it as a sortField:
sortField: [{ field: 'value' }]http://jsfiddle.net/3pRC6/Or you can add an
$orderproperty to your objects which is what selectize checks for by default. http://jsfiddle.net/tm65s/vishalvijay commentedon Aug 20, 2014
Same issue here using
v0.11. I able to solve bysortField: [].daylen commentedon Oct 7, 2014
I have the same issue; elements are totally out of order in Google Chrome 39 but are in order in Safari 8 beta. Using Selectize 0.11. The fix was to use
sortField: []. Not sure why that works, but it does.mike-suggitt commentedon Nov 25, 2014
It looks like this is still an issue. I've just forked the repo and get the same issue when remotely retrieving data. Options are placed into an associative array indexed by their id. This fundamentally reorders them. Applying no sortField or a sortField of [] doesn't work for me. What I've looked to do is re-assign the $order property that is the default sort property. This usually looks at non-dynamic data without ids (i.e. html option tags) and assigns it as an incremental index. I overwrite this for dynamic data and so if no sortField is specified it falls back to the $order property and works correctly
Refactored $order prop to be added by addOption, addOptionGroup (closes