send option on autocomplete

This commit is contained in:
Rolux 2010-02-20 16:21:55 +05:30
parent 78cb96b75b
commit 2699634ac9

View File

@ -1647,11 +1647,11 @@ requires
if (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;
} else if (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;
}
if (Ox.isArray(self.options.autocomplete)) {
@ -1745,11 +1745,12 @@ requires
});
function autocomplete(value, callback) {
var items = [];
var value = value.toLowerCase(),
items = [];
if (value === "") {
// items = self.options.autocomplete[self.placeholder];
} 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) {
items.push(item);
}
@ -1759,11 +1760,13 @@ requires
}
function call() {
var value = that.$input.val().toLowerCase();
var value = that.$input.val();
if (self.options.autocomplete) {
Ox.isFunction(self.options.autocomplete) ?
self.options.autocomplete(value, callback) :
autocomplete(value, callback);
Ox.isFunction(self.options.autocomplete) ? (
self.option ?
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();
if (items.length) {
items = $.map(items, function(title, position) {
if (that.$input.val().toLowerCase() == Ox.stripTags(title.toLowerCase())) {
if (value == Ox.stripTags(title.toLowerCase())) {
selected = position;
}
return {