1
0
mirror of synced 2025-02-04 06:09:23 +03:00

Merge pull request #122 from pothibo/zIndex

set z-index of the dropdown menu in the options
This commit is contained in:
Igor Vaynberg 2012-06-14 09:35:43 -07:00
commit 7007bf8c38

View File

@ -72,7 +72,7 @@
function indexOf(value, array) { function indexOf(value, array) {
var i = 0, l = array.length, v; var i = 0, l = array.length, v;
if (typeof value == 'undefined') { if (typeof value === "undefined") {
return -1; return -1;
} }
@ -246,7 +246,6 @@
} }
// TODO 3.0 - replace query.page with query so users have access to term, page, etc. // TODO 3.0 - replace query.page with query so users have access to term, page, etc.
var results = options.results(data, query.page); var results = options.results(data, query.page);
self.context = results.context;
query.callback(results); query.callback(results);
} }
}); });
@ -650,12 +649,15 @@
var offset = this.container.offset(); var offset = this.container.offset();
var height = this.container.outerHeight(); var height = this.container.outerHeight();
var width = this.container.outerWidth(); var width = this.container.outerWidth();
var css = {
this.dropdown.css({
top: offset.top + height, top: offset.top + height,
left: offset.left, left: offset.left,
width: width width: width
}); }
if (this.opts.dropdownZIndex !== undefined) {
css["z-index"] = this.opts.dropdownZIndex
}
this.dropdown.css(css);
}, },
open: function () { open: function () {
@ -832,6 +834,9 @@
callback: this.bind(function (data) { callback: this.bind(function (data) {
var def; // default choice var def; // default choice
// save context, if any
this.context = (data.context===undefined) ? null : data.context;
// create a default choice and prepend it to the list // create a default choice and prepend it to the list
if (this.opts.createSearchChoice && search.val() !== "") { if (this.opts.createSearchChoice && search.val() !== "") {
def = this.opts.createSearchChoice.call(null, search.val(), data.results); def = this.opts.createSearchChoice.call(null, search.val(), data.results);
@ -1570,7 +1575,6 @@
val = (val === null) ? [] : val; val = (val === null) ? [] : val;
this.setVal(val); this.setVal(val);
// val is a list of objects // val is a list of objects
st
$(val).each(function () { data.push(self.id(this)); }); $(val).each(function () { data.push(self.id(this)); });
this.setVal(data); this.setVal(data);
this.updateSelection(val); this.updateSelection(val);