send option on autocomplete
This commit is contained in:
parent
17321a24a8
commit
26cb4b5c15
1 changed files with 12 additions and 9 deletions
|
@ -1647,11 +1647,11 @@ requires
|
||||||
|
|
||||||
if (self.options.label) {
|
if (self.options.label) {
|
||||||
self.options.label = Ox.makeArray(self.options.label);
|
self.options.label = Ox.makeArray(self.options.label);
|
||||||
self.label = self.options.label[self.options.selected];
|
self.option = self.options.label[self.options.selected];
|
||||||
self.items = self.options.label;
|
self.items = self.options.label;
|
||||||
} else if (self.options.placeholder) {
|
} else if (self.options.placeholder) {
|
||||||
self.options.placeholder = Ox.makeArray(self.options.placeholder);
|
self.options.placeholder = Ox.makeArray(self.options.placeholder);
|
||||||
self.placeholder = self.options.placeholder[self.options.selected];
|
self.option = self.options.placeholder[self.options.selected];
|
||||||
self.items = self.options.placeholder;
|
self.items = self.options.placeholder;
|
||||||
}
|
}
|
||||||
if (Ox.isArray(self.options.autocomplete)) {
|
if (Ox.isArray(self.options.autocomplete)) {
|
||||||
|
@ -1745,11 +1745,12 @@ requires
|
||||||
});
|
});
|
||||||
|
|
||||||
function autocomplete(value, callback) {
|
function autocomplete(value, callback) {
|
||||||
var items = [];
|
var value = value.toLowerCase(),
|
||||||
|
items = [];
|
||||||
if (value === "") {
|
if (value === "") {
|
||||||
// items = self.options.autocomplete[self.placeholder];
|
// items = self.options.autocomplete[self.placeholder];
|
||||||
} else {
|
} else {
|
||||||
$.each(self.options.autocomplete[self.label || self.placeholder], function(i, item) {
|
$.each(self.options.autocomplete[self.option], function(i, item) {
|
||||||
if (item.toLowerCase().indexOf(value) > -1) {
|
if (item.toLowerCase().indexOf(value) > -1) {
|
||||||
items.push(item);
|
items.push(item);
|
||||||
}
|
}
|
||||||
|
@ -1759,11 +1760,13 @@ requires
|
||||||
}
|
}
|
||||||
|
|
||||||
function call() {
|
function call() {
|
||||||
var value = that.$input.val().toLowerCase();
|
var value = that.$input.val();
|
||||||
if (self.options.autocomplete) {
|
if (self.options.autocomplete) {
|
||||||
Ox.isFunction(self.options.autocomplete) ?
|
Ox.isFunction(self.options.autocomplete) ? (
|
||||||
self.options.autocomplete(value, callback) :
|
self.option ?
|
||||||
autocomplete(value, callback);
|
self.options.autocomplete(self.option, value, callback) :
|
||||||
|
self.options.autocomplete(value, callback)
|
||||||
|
) : autocomplete(value, callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1772,7 +1775,7 @@ requires
|
||||||
value = that.$input.val().toLowerCase();
|
value = that.$input.val().toLowerCase();
|
||||||
if (items.length) {
|
if (items.length) {
|
||||||
items = $.map(items, function(title, position) {
|
items = $.map(items, function(title, position) {
|
||||||
if (that.$input.val().toLowerCase() == Ox.stripTags(title.toLowerCase())) {
|
if (value == Ox.stripTags(title.toLowerCase())) {
|
||||||
selected = position;
|
selected = position;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue