--- /dev/null
+Ext.namespace("Ext.ux.grid.filter");\r
+Ext.ux.grid.filter.Filter = function(config){\r
+ Ext.apply(this, config);\r
+ \r
+ this.events = {\r
+ /**\r
+ * @event activate\r
+ * Fires when a inactive filter becomes active\r
+ * @param {Ext.ux.grid.filter.Filter} this\r
+ */\r
+ 'activate': true,\r
+ /**\r
+ * @event deactivate\r
+ * Fires when a active filter becomes inactive\r
+ * @param {Ext.ux.grid.filter.Filter} this\r
+ */\r
+ 'deactivate': true,\r
+ /**\r
+ * @event update\r
+ * Fires when a filter configuration has changed\r
+ * @param {Ext.ux.grid.filter.Filter} this\r
+ */\r
+ 'update': true,\r
+ /**\r
+ * @event serialize\r
+ * Fires after the serialization process. Use this to apply additional parameters to the serialized data.\r
+ * @param {Array/Object} data A map or collection of maps representing the current filter configuration.\r
+ * @param {Ext.ux.grid.filter.Filter} filter The filter being serialized.\r
+ **/\r
+ 'serialize': true\r
+ };\r
+ Ext.ux.grid.filter.Filter.superclass.constructor.call(this);\r
+ \r
+ this.menu = new Ext.menu.Menu();\r
+ this.init();\r
+ \r
+ if(config && config.value){\r
+ this.setValue(config.value);\r
+ this.setActive(config.active !== false, true);\r
+ delete config.value;\r
+ }\r
+};\r
+Ext.extend(Ext.ux.grid.filter.Filter, Ext.util.Observable, {\r
+ /**\r
+ * @cfg {Boolean} active\r
+ * Indicates the default status of the filter (defaults to false).\r
+ */\r
+ /**\r
+ * True if this filter is active. Read-only.\r
+ * @type Boolean\r
+ * @property\r
+ */\r
+ active: false,\r
+ /**\r
+ * @cfg {String} dataIndex \r
+ * The {@link Ext.data.Store} data index of the field this filter represents. The dataIndex does not actually\r
+ * have to exist in the store.\r
+ */\r
+ dataIndex: null,\r
+ /**\r
+ * The filter configuration menu that will be installed into the filter submenu of a column menu.\r
+ * @type Ext.menu.Menu\r
+ * @property\r
+ */\r
+ menu: null,\r
+ \r
+ /**\r
+ * Initialize the filter and install required menu items.\r
+ */\r
+ init: Ext.emptyFn,\r
+ \r
+ fireUpdate: function(){\r
+ this.value = this.item.getValue();\r
+ \r
+ if(this.active)\r
+ this.fireEvent("update", this);\r
+ \r
+ this.setActive(this.value.length > 0);\r
+ },\r
+ \r
+ /**\r
+ * Returns true if the filter has enough configuration information to be activated.\r
+ * \r
+ * @return {Boolean}\r
+ */\r
+ isActivatable: function(){\r
+ return true;\r
+ },\r
+ \r
+ /**\r
+ * Sets the status of the filter and fires that appropriate events.\r
+ * \r
+ * @param {Boolean} active The new filter state.\r
+ * @param {Boolean} suppressEvent True to prevent events from being fired.\r
+ */\r
+ setActive: function(active, suppressEvent){\r
+ if(this.active != active){\r
+ this.active = active;\r
+ if(suppressEvent !== true)\r
+ this.fireEvent(active ? 'activate' : 'deactivate', this);\r
+ }\r
+ },\r
+ \r
+ /**\r
+ * Get the value of the filter\r
+ * \r
+ * @return {Object} The 'serialized' form of this filter\r
+ */\r
+ getValue: Ext.emptyFn,\r
+ \r
+ /**\r
+ * Set the value of the filter.\r
+ * \r
+ * @param {Object} data The value of the filter\r
+ */ \r
+ setValue: Ext.emptyFn,\r
+ \r
+ /**\r
+ * Serialize the filter data for transmission to the server.\r
+ * \r
+ * @return {Object/Array} An object or collection of objects containing key value pairs representing\r
+ * the current configuration of the filter.\r
+ */\r
+ serialize: Ext.emptyFn,\r
+ \r
+ /**\r
+ * Validates the provided Ext.data.Record against the filters configuration.\r
+ * \r
+ * @param {Ext.data.Record} record The record to validate\r
+ * \r
+ * @return {Boolean} True if the record is valid with in the bounds of the filter, false otherwise.\r
+ */\r
+ validateRecord: function(){return true;}\r
+});
\ No newline at end of file