fixes #814: load options after initialization of selectize in the server mode

This commit is contained in:
Yihui Xie
2015-05-10 01:03:25 -05:00
parent 6fc0bac106
commit 7554f8395b
2 changed files with 5 additions and 2 deletions

View File

@@ -56,7 +56,6 @@ $.extend(selectInputBinding, {
selectize = this._selectize(el);
selectize.clearOptions();
selectize.settings.load = function(query, callback) {
if (!query.length) return callback();
var settings = selectize.settings;
$.ajax({
url: data.url,
@@ -75,6 +74,10 @@ $.extend(selectInputBinding, {
}
});
};
// perform an empty search after changing the `load` function
selectize.load(function(callback) {
selectize.settings.load.apply(selectize, ['', callback]);
});
if (data.hasOwnProperty('selected'))
selectize.addOption(data.selected);
}