in input elements, disable showing the autocomplete menu on focus

This commit is contained in:
rlx 2011-11-11 11:48:52 +00:00
parent b0065e1ec8
commit 571e3a3512
3 changed files with 22 additions and 14 deletions

View file

@ -75,8 +75,8 @@ Ox.Filter = function(options, self) {
{id: '!=,', title: 'is not between'} {id: '!=,', title: 'is not between'}
], ],
list: [ list: [
{id: '=', title: 'is'}, {id: '==', title: 'is'},
{id: '!=', title: 'is not'} {id: '!==', title: 'is not'}
], ],
number: [ number: [
{id: '=', title: 'is'}, {id: '=', title: 'is'},
@ -120,7 +120,7 @@ Ox.Filter = function(options, self) {
float: 0, float: 0,
hue: 0, hue: 0,
integer: 0, integer: 0,
list: 0, list: '',
string: '', string: '',
text: '', text: '',
time: '00:00:00', time: '00:00:00',
@ -599,8 +599,10 @@ Ox.Filter = function(options, self) {
] ]
}) })
).bindEvent({ ).bindEvent({
change: function(data) { change: change,
Ox.Log('FILTER', 'change event', data) submit: change
});
function change(data) {
var $element = data._element.parent(); var $element = data._element.parent();
changeConditionValue( changeConditionValue(
$element.data('position'), $element.data('position'),
@ -608,7 +610,6 @@ Ox.Filter = function(options, self) {
data.value data.value
); );
} }
});
} }
function renderConditions() { function renderConditions() {
@ -705,6 +706,7 @@ Ox.Filter = function(options, self) {
$input = Ox.Input({ $input = Ox.Input({
autocomplete: findKey.values, autocomplete: findKey.values,
autocompleteSelect: true, autocompleteSelect: true,
autocompleteSelectSubmit: true,
value: value, value: value,
width: 288 width: 288
}); });

View file

@ -45,6 +45,9 @@ Ox.FormElementGroup = function(options, self) {
change: function(data) { change: function(data) {
that.triggerEvent({change: {value: that.value()}}); that.triggerEvent({change: {value: that.value()}});
}, },
submit: function(data) {
that.triggerEvent({change: {value: that.value()}});
},
validate: function(data) { validate: function(data) {
that.triggerEvent({validate: data}); that.triggerEvent({validate: data});
} }

View file

@ -300,7 +300,7 @@ Ox.Input = function(options, self) {
oldValue = Ox.isUndefined(oldValue) ? self.options.value : oldValue; oldValue = Ox.isUndefined(oldValue) ? self.options.value : oldValue;
oldCursor = Ox.isUndefined(oldCursor) ? cursor() : oldCursor; oldCursor = Ox.isUndefined(oldCursor) ? cursor() : oldCursor;
Ox.Log('Form', 'autocomplete', oldValue, oldCursor) Ox.Log('AUTO', 'autocomplete', oldValue, oldCursor)
if (self.options.value || self.options.autocompleteReplaceCorrect) { if (self.options.value || self.options.autocompleteReplaceCorrect) {
if (Ox.isFunction(self.options.autocomplete)) { if (Ox.isFunction(self.options.autocomplete)) {
@ -404,6 +404,7 @@ Ox.Input = function(options, self) {
}); });
self.selectEventBound = true; self.selectEventBound = true;
} }
Ox.Log('AUTO', 'show menu')
self.$autocompleteMenu.options({ self.$autocompleteMenu.options({
selected: selected selected: selected
}).showMenu(); }).showMenu();
@ -692,7 +693,8 @@ Ox.Input = function(options, self) {
// fixme: different in webkit and firefox (?), see keyboard handler, need generic function // fixme: different in webkit and firefox (?), see keyboard handler, need generic function
Ox.UI.$document.keydown(keydown); Ox.UI.$document.keydown(keydown);
//Ox.UI.$document.keypress(keypress); //Ox.UI.$document.keypress(keypress);
self.options.autocompleteSelect && setTimeout(autocomplete, 0); // fixme: why is the timeout needed? // temporarily disabled autocomplete on focus
//self.options.autocompleteSelect && setTimeout(autocomplete, 0); // fixme: why is the timeout needed?
} }
that.triggerEvent('focus'); that.triggerEvent('focus');
} }
@ -725,6 +727,7 @@ Ox.Input = function(options, self) {
} }
if (value != self.options.value) { if (value != self.options.value) {
self.options.value = value; self.options.value = value;
Ox.Log('AUTO', 'call autocomplete from keydown')
self.options.autocomplete && autocomplete(oldValue, oldCursor); self.options.autocomplete && autocomplete(oldValue, oldCursor);
self.options.autovalidate && autovalidate(oldValue, oldCursor); self.options.autovalidate && autovalidate(oldValue, oldCursor);
self.options.changeOnKeypress && that.triggerEvent({ self.options.changeOnKeypress && that.triggerEvent({