Fix selectize misordering on updateSelectInput

Repro case at https://gist.github.com/jcheng5/9403917
This commit is contained in:
Joe Cheng
2014-03-06 18:25:55 -08:00
parent 75c3bf0c2f
commit d63f83fcbb

View File

@@ -1998,6 +1998,13 @@
if (selectize) {
selectize = selectize[0].selectize;
selectize.clearOptions();
// Selectize.js doesn't maintain insertion order on Chrome on Mac
// with >10 items if inserted using addOption (versus being present
// in the DOM at selectize() time). Putting $order on each option
// makes it work.
$.each(data.options, function(i, opt) {
opt.$order = i;
});
selectize.addOption(data.options);
}
for (var i = 0; i < data.options.length; i++) {