// crear un espacio de nombre para los plugins
Ext.namespace('Ext.ux.plugins');
 
/**
 * Ext.ux.plugins.linkedCombo plugin for Ext.form.Combobox
 *
 * @autor  Ing. Omar Vidaña
 * @fecha    1 de junio del 2009
 *
 * @class Ext.ux.plugins.linkedCombo
 * @extends Ext.util.Observable
 * propiedad linkedCombo: id o Ext.component  para ahi tener la referencia al objeto combo hijo
 * propiedad reloadParams: array de variables para ser evaluadas al recargar el dataset del combo
 */
Ext.ux.plugins.textFilter = function(config) {
    Ext.apply(this, config);
};
 
// codigo del plugin
Ext.extend(Ext.ux.plugins.textFilter, Ext.util.Observable, {
    init:function(text) {
 		Ext.apply(text, {
			
			queryDelay: 300
			,
			onKeyUp : /*text.onKeyUp.createSequence(*/function(e){

				if (e.getKey() != 40) {
					if (this.queryFunction) {
						this.clearQuery();
						this.queryExecute();
					}
				}
				
				this.fireEvent('keyup', this, e);
			},
			clearQuery: function (){
				clearTimeout(this.query);
			},
			queryExecute: function(){
				this.query = setTimeout(this.queryFunction, this.getQueryDelay());
			},
			getQueryDelay: function(){
				return this.queryDelay;
			}
		}); // fin del apply
		
    } // fin del init
}); // fin del extend
 
