@@ -903,6 +903,11 @@ Selectize.prototype.refreshOptions = function(triggerDropdown) {
903
903
* the options list dropdown (use `refreshOptions`
904
904
* for that).
905
905
*
906
+ * Usage:
907
+ *
908
+ * this.addOption(value, data)
909
+ * this.addOption(data)
910
+ *
906
911
* @param {string } value
907
912
* @param {object } data
908
913
*/
@@ -949,7 +954,7 @@ Selectize.prototype.updateOption = function(value, data) {
949
954
} ;
950
955
951
956
/**
952
- * Removes an option.
957
+ * Removes a single option.
953
958
*
954
959
* @param {string } value
955
960
*/
@@ -962,6 +967,17 @@ Selectize.prototype.removeOption = function(value) {
962
967
this . removeItem ( value ) ;
963
968
} ;
964
969
970
+ /**
971
+ * Clears all options.
972
+ */
973
+ Selectize . prototype . clearOptions = function ( ) {
974
+ this . userOptions = { } ;
975
+ this . options = { } ;
976
+ this . lastQuery = null ;
977
+ this . trigger ( 'onOptionClear' ) ;
978
+ this . clear ( ) ;
979
+ } ;
980
+
965
981
/**
966
982
* Returns the jQuery element of the option
967
983
* matching the given value.
@@ -1519,6 +1535,7 @@ Selectize.defaults = {
1519
1535
onClear : null , // function() { ... }
1520
1536
onOptionAdd : null , // function(value, data) { ... }
1521
1537
onOptionRemove : null , // function(value) { ... }
1538
+ onOptionClear : null , // function() { ... }
1522
1539
onDropdownOpen : null , // function($dropdown) { ... }
1523
1540
onDropdownClose : null , // function($dropdown) { ... }
1524
1541
onType : null , // function(str) { ... }
0 commit comments