diff --git a/docs/api.md b/docs/api.md index 32f54c22e..0a17e5548 100644 --- a/docs/api.md +++ b/docs/api.md @@ -61,8 +61,8 @@ var selectize = $select[0].selectize; Removes the option identified by the given value. - clearOptions() - Removes all options from the control. + clearOptions(silent) + Removes all options from the control, and resets/clears all selected items. If silent is truthy, no change event will be fired on the original input. getOption(value) diff --git a/src/selectize.js b/src/selectize.js index 3d1397f85..99dd04e57 100644 --- a/src/selectize.js +++ b/src/selectize.js @@ -1367,8 +1367,10 @@ $.extend(Selectize.prototype, { /** * Clears all options. + * + * @param {boolean} silent */ - clearOptions: function() { + clearOptions: function(silent) { var self = this; self.loadedSearches = {}; @@ -1383,6 +1385,7 @@ $.extend(Selectize.prototype, { self.options = self.sifter.items = options; self.lastQuery = null; self.trigger('option_clear'); + self.clear(silent); }, /**