autocomplete, continued

This commit is contained in:
Rolux 2010-02-19 16:04:51 +05:30
parent c533678f44
commit 133753350b
2 changed files with 17 additions and 9 deletions

View file

@ -1564,10 +1564,10 @@ requires
if (self.options.label) {
self.options.label = Ox.makeArray(self.options.label);
self.label = self.options.label[0];
self.label = self.options.label[self.options.selected];
} else if (self.options.placeholder) {
self.options.placeholder = Ox.makeArray(self.options.placeholder);
self.placeholder = self.options.placeholder[0];
self.placeholder = self.options.placeholder[self.options.selected];
}
if (Ox.isArray(self.options.autocomplete)) {
autocomplete = self.options.autocomplete;
@ -1596,7 +1596,11 @@ requires
group: self.placeholderId, // fixme: same id, works here, but should be different
title: title
};
})
}),
offset: {
left: 4,
top: 0
}
});
that.bindEvent("change_" + self.placeholderId, changePlaceholder);
}
@ -1650,7 +1654,7 @@ requires
value = value.toLowerCase();
var items = [];
if (value === "") {
items = self.options.autocomplete[self.placeholder];
// items = self.options.autocomplete[self.placeholder];
} else {
$.each(self.options.autocomplete[self.placeholder], function(i, item) {
if (item.toLowerCase().indexOf(value) > -1) {
@ -1699,11 +1703,12 @@ requires
}
function cancel() {
that.$input.trigger("blur");
that.$input.blur();
}
function clear() {
that.$input.val("");
that.$input.val("").focus();
//call();
}
function change() {
@ -1715,8 +1720,10 @@ requires
self.placeholder = data.value; // fixme: could be "title" as well
if (that.$input.is(".OxPlaceholder")) {
that.$input.val(self.placeholder);
} else {
that.$input.focus();
call();
}
call();
}
function blur() {

View file

@ -398,8 +398,9 @@
clear: true,
highlight: true,
id: "citystate",
placeholder: ["City", "State"]
}).addClass("margin").width(128).appendTo(mainPanel);
placeholder: ["City", "State"],
selected: 1
}).addClass("margin").width(160).appendTo(mainPanel);
//*/
function switchTheme() {
if (Ox.theme() == "classic") {