Ox.Input: add autocompleteSelectOffset and autocompleteSelectUpdate options

This commit is contained in:
rolux 2014-12-17 14:35:10 +00:00
parent a21327ff7e
commit c36243d31c

View file

@ -12,7 +12,9 @@ Ox.Input <f> Input Element
autocompleteSelect <b> if true, menu is displayed
autocompleteSelectHighlight <b> if true, value in menu is highlighted
autocompleteSelectMaxWidth <n|0> Maximum width of autocomplete menu, or 0
autocompleteSelectOffset <o|{left: 4, top: 0}> Offset of autocomplete menu
autocompleteSelectSubmit <b> if true, submit input on menu selection
autocompleteSelectUpdate <b> if true, update menu position on keypress
autocorrect <s|r|f|null> ('email', 'float', 'int', 'phone', 'url'), or
<r> regexp(value), or
<f> function(key, value, blur, callback), returns value
@ -84,7 +86,9 @@ Ox.Input = function(options, self) {
autocompleteSelectHighlight: false,
autocompleteSelectMax: 0,
autocompleteSelectMaxWidth: 0,
autocompleteSelectOffset: {left: 4, top: 0},
autocompleteSelectSubmit: false,
autocompleteSelectUpdate: false,
autovalidate: null,
changeOnKeypress: false,
clear: false,
@ -480,6 +484,9 @@ Ox.Input = function(options, self) {
});
self.selectEventBound = true;
}
if (self.options.autocompleteSelectUpdate) {
self.$autocompleteMenu.updatePosition();
}
self.$autocompleteMenu.options({
selected: selected
}).showMenu();
@ -725,10 +732,7 @@ Ox.Input = function(options, self) {
element: self.$input,
id: self.options.id + 'Menu', // fixme: we do this in other places ... are we doing it the same way? var name?,
maxWidth: self.options.autocompleteSelectMaxWidth,
offset: {
left: 4,
top: 0
}
offset: self.options.autocompleteSelectOffset
})
.addClass('OxAutocompleteMenu OxKeyboardFocus')
.bindEvent({