Permalink
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...
1 parent 0c11ed7 commit fdc9c127bf894d33d6f284840c62c3b491b032da Jesper Rønn-Jensen committed Oct 1, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 select2.js
View
@@ -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));
}

0 comments on commit fdc9c12

Please sign in to comment.