From 51ac04af9b10f18ecce2ec09153beda399aa4a40 Mon Sep 17 00:00:00 2001 From: Renaud Le Gac <renaud.legac@free.fr> Date: Tue, 14 Dec 2010 21:11:51 +0000 Subject: [PATCH] press return is not need anymore on texfield. just type the value and wait. --- static/plugin_dbui/lib/appgridfilter.js | 31 +++++++++++-------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/static/plugin_dbui/lib/appgridfilter.js b/static/plugin_dbui/lib/appgridfilter.js index 80453290..59f84a02 100644 --- a/static/plugin_dbui/lib/appgridfilter.js +++ b/static/plugin_dbui/lib/appgridfilter.js @@ -38,8 +38,12 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, { /** * Predefined setting + * + * NOTE: + * the enableKeyEvents is mandatory for Ext.form.TextField */ - defaults: {anchor: '100%'}, + defaults: {anchor: '100%', + enableKeyEvents: true}, /** * private method requests by the component model of Ext JS @@ -54,13 +58,14 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, { for (var i = 0; i < fields.length; i++){ field = fields[i]; - // catch a change of value for combo box + // catch a change of value for combobox if (field.xtype == 'xcombobox') - field.on('select', this.onComboSelect, this); + field.on('select', this.onChange, this); // catch the key pressed enter for other fields + // wait that user finish to type to run the handler else - field.on('specialkey', this.onKeyPressedEnter, this); + field.on('keyup', this.onChange, this, {buffer: 500}); } }, @@ -85,22 +90,12 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, { }, /** - * Handler to catch a new selection in combobox + * Handler to catch a change in field value */ - onComboSelect: function(combo, record, index){ - this.setupCondition(combo); + onChange: function(field){ + this.setupCondition(field); }, - /** - * Handler to catch the ENTER - * @param {Object} field - * @param {Object} e - */ - onKeyPressedEnter: function(field, e){ - if (e.getKey() == e.ENTER) - this.setupCondition(field); - }, - /** * Handler to reset the filter */ @@ -145,7 +140,7 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, { conditions.push(this.filterConditions[k]); } - // push new condtion in the where clause of the store + // push new condition in the where clause of the store this.store.baseParams.where = conditions; // update the store -- GitLab