From c36243d31c4a2cf2eeb3778edd5bcff564f5def6 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 17 Dec 2014 14:35:10 +0000 Subject: [PATCH] Ox.Input: add autocompleteSelectOffset and autocompleteSelectUpdate options --- source/UI/js/Form/Input.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/UI/js/Form/Input.js b/source/UI/js/Form/Input.js index 61f9eae1..a2873e5c 100644 --- a/source/UI/js/Form/Input.js +++ b/source/UI/js/Form/Input.js @@ -12,7 +12,9 @@ Ox.Input Input Element autocompleteSelect if true, menu is displayed autocompleteSelectHighlight if true, value in menu is highlighted autocompleteSelectMaxWidth Maximum width of autocomplete menu, or 0 + autocompleteSelectOffset Offset of autocomplete menu autocompleteSelectSubmit if true, submit input on menu selection + autocompleteSelectUpdate if true, update menu position on keypress autocorrect ('email', 'float', 'int', 'phone', 'url'), or regexp(value), or 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({