Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added API change to select2, so you can get to the search field progr…

…amatically

Example:
$(obj).select2("search")  => reference to the input field, select2 shows as input element. This is very
                             convenient for automatic testing purposes
  • Loading branch information...
commit fdc9c127bf894d33d6f284840c62c3b491b032da 1 parent 0c11ed7
Jesper Rønn-Jensen authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 select2.js
View
4 select2.js
@@ -2300,7 +2300,7 @@
var args = Array.prototype.slice.call(arguments, 0),
opts,
select2,
- value, multiple, allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "onSortStart", "onSortEnd", "enable", "disable", "positionDropdown", "data"];
+ value, multiple, allowedMethods = ["search", "val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "onSortStart", "onSortEnd", "enable", "disable", "positionDropdown", "data"];
this.each(function () {
if (args.length === 0 || typeof(args[0]) === "object") {
@@ -2327,6 +2327,8 @@
if (select2 === undefined) return;
if (args[0] === "container") {
value=select2.container;
+ } else if (args[0] === "search") {
+ value=select2.search;
} else {
value = select2[args[0]].apply(select2, args.slice(1));
}
Please sign in to comment.
Something went wrong with that request. Please try again.