From 06130ffc12b8ede74e4467cacabb6d80ab3f6dba Mon Sep 17 00:00:00 2001 From: Mike S Date: Wed, 29 May 2013 10:24:30 -0700 Subject: [PATCH 1/3] Added setSearch method --- select2.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 8db94e4d..a03e51cc 100644 --- a/select2.js +++ b/select2.js @@ -1339,6 +1339,16 @@ the specific language governing permissions and limitations under the Apache Lic this.opts.element.trigger($.Event("select2-close")); }, + /** + * Opens control, sets input value, and updates results. + */ + // abstract + setSearch: function (term) { + this.open(); + this.search.val(term); + this.updateResults(false); + }, + // abstract clearSearch: function () { @@ -3024,7 +3034,7 @@ the specific language governing permissions and limitations under the Apache Lic opts, select2, value, multiple, - allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "readonly", "positionDropdown", "data"], + allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "onSortStart", "onSortEnd", "enable", "readonly", "positionDropdown", "data", "setSearch"], valueMethods = ["val", "opened", "isFocused", "container", "data"]; this.each(function () { From 796c9e802af628ec1643f1b46e85dda591b3e7d6 Mon Sep 17 00:00:00 2001 From: Mike S Date: Thu, 30 May 2013 12:56:05 -0700 Subject: [PATCH 2/3] Renamed to search --- select2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/select2.js b/select2.js index a03e51cc..413572c5 100644 --- a/select2.js +++ b/select2.js @@ -1343,7 +1343,7 @@ the specific language governing permissions and limitations under the Apache Lic * Opens control, sets input value, and updates results. */ // abstract - setSearch: function (term) { + search: function (term) { this.open(); this.search.val(term); this.updateResults(false); @@ -3034,7 +3034,7 @@ the specific language governing permissions and limitations under the Apache Lic opts, select2, value, multiple, - allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "onSortStart", "onSortEnd", "enable", "readonly", "positionDropdown", "data", "setSearch"], + allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "onSortStart", "onSortEnd", "enable", "readonly", "positionDropdown", "data", "search"], valueMethods = ["val", "opened", "isFocused", "container", "data"]; this.each(function () { From bbd08bec034602dd4726f2abc298c1e7d788c23b Mon Sep 17 00:00:00 2001 From: Mike S Date: Tue, 4 Jun 2013 10:09:49 -0700 Subject: [PATCH 3/3] Restoring allowedMethod container --- select2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 413572c5..4d2ec19d 100644 --- a/select2.js +++ b/select2.js @@ -3034,7 +3034,7 @@ the specific language governing permissions and limitations under the Apache Lic opts, select2, value, multiple, - allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "onSortStart", "onSortEnd", "enable", "readonly", "positionDropdown", "data", "search"], + allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "readonly", "positionDropdown", "data", "search"], valueMethods = ["val", "opened", "isFocused", "container", "data"]; this.each(function () {