-/*!
- * Ext JS Library 3.3.1
- * Copyright(c) 2006-2010 Sencha Inc.
- * licensing@sencha.com
- * http://www.sencha.com/license
- */
-Ext.namespace('Ext.ux.grid.filter');
-
-/**
+/**
* @class Ext.ux.grid.filter.Filter
* @extends Ext.util.Observable
* Abstract base class for filter implementations.
*/
-Ext.ux.grid.filter.Filter = Ext.extend(Ext.util.Observable, {
+Ext.define('Ext.ux.grid.filter.Filter', {
+ extend: 'Ext.util.Observable',
+
/**
* @cfg {Boolean} active
* Indicates the initial status of the filter (defaults to false).
* @property active
*/
/**
- * @cfg {String} dataIndex
+ * @cfg {String} dataIndex
* The {@link Ext.data.Store} dataIndex of the field this filter represents.
* The dataIndex does not actually have to exist in the store.
*/
menu : null,
/**
* @cfg {Number} updateBuffer
- * Number of milliseconds to wait after user interaction to fire an update. Only supported
+ * Number of milliseconds to wait after user interaction to fire an update. Only supported
* by filters: 'list', 'numeric', and 'string'. Defaults to 500.
*/
updateBuffer : 500,
constructor : function (config) {
Ext.apply(this, config);
-
+
this.addEvents(
/**
* @event activate
);
Ext.ux.grid.filter.Filter.superclass.constructor.call(this);
- this.menu = new Ext.menu.Menu();
+ this.menu = this.createMenu(config);
this.init(config);
if(config && config.value){
this.setValue(config.value);
if (this.menu){
this.menu.destroy();
}
- this.purgeListeners();
+ this.clearListeners();
},
/**
* Defaults to Ext.emptyFn.
*/
init : Ext.emptyFn,
-
+
+ /**
+ * @private @override
+ * Creates the Menu for this filter.
+ * @param {Object} config Filter configuration
+ * @return {Ext.menu.Menu}
+ */
+ createMenu: function(config) {
+ return Ext.create('Ext.menu.Menu', config);
+ },
+
/**
* Template method to be implemented by all subclasses that is to
* get and return the value of the filter.
* @methodOf Ext.ux.grid.filter.Filter
*/
getValue : Ext.emptyFn,
-
+
/**
* Template method to be implemented by all subclasses that is to
* set the value of the filter and fire the 'update' event.
* Defaults to Ext.emptyFn.
* @param {Object} data The value to set the filter
* @methodOf Ext.ux.grid.filter.Filter
- */
+ */
setValue : Ext.emptyFn,
-
+
/**
* Template method to be implemented by all subclasses that is to
* return <tt>true</tt> if the filter has enough configuration information to be activated.
isActivatable : function(){
return true;
},
-
+
/**
* Template method to be implemented by all subclasses that is to
* get and return serialized filter data for transmission to the server.
}
this.setActive(this.isActivatable());
},
-
+
/**
* Sets the status of the filter and fires the appropriate events.
* @param {Boolean} active The new filter state.
this.fireEvent(active ? 'activate' : 'deactivate', this);
}
}
- }
-});
\ No newline at end of file
+ }
+});