Skip to content

Commit 06130ff

Browse files
author
Mike S
committed
Added setSearch method
1 parent 30dac9a commit 06130ff

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

select2.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,16 @@ the specific language governing permissions and limitations under the Apache Lic
13391339
this.opts.element.trigger($.Event("select2-close"));
13401340
},
13411341

1342+
/**
1343+
* Opens control, sets input value, and updates results.
1344+
*/
1345+
// abstract
1346+
setSearch: function (term) {
1347+
this.open();
1348+
this.search.val(term);
1349+
this.updateResults(false);
1350+
},
1351+
13421352
// abstract
13431353
clearSearch: function () {
13441354

@@ -3024,7 +3034,7 @@ the specific language governing permissions and limitations under the Apache Lic
30243034
opts,
30253035
select2,
30263036
value, multiple,
3027-
allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "readonly", "positionDropdown", "data"],
3037+
allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "onSortStart", "onSortEnd", "enable", "readonly", "positionDropdown", "data", "setSearch"],
30283038
valueMethods = ["val", "opened", "isFocused", "container", "data"];
30293039

30303040
this.each(function () {

0 commit comments

Comments
 (0)