2 * Ext JS Library 2.2.1
\r
3 * Copyright(c) 2006-2009, Ext JS, LLC.
\r
4 * licensing@extjs.com
\r
6 * http://extjs.com/license
\r
9 Ext.ns("Ext.grid.filter");
\r
10 Ext.grid.filter.Filter = function(config){
\r
11 Ext.apply(this, config);
\r
16 * Fires when a inactive filter becomes active
\r
17 * @param {Ext.ux.grid.filter.Filter} this
\r
22 * Fires when a active filter becomes inactive
\r
23 * @param {Ext.ux.grid.filter.Filter} this
\r
28 * Fires when a filter configuration has changed
\r
29 * @param {Ext.ux.grid.filter.Filter} this
\r
34 * Fires after the serialization process. Use this to apply additional parameters to the serialized data.
\r
35 * @param {Array/Object} data A map or collection of maps representing the current filter configuration.
\r
36 * @param {Ext.ux.grid.filter.Filter} filter The filter being serialized.
\r
40 Ext.grid.filter.Filter.superclass.constructor.call(this);
\r
42 this.menu = new Ext.menu.Menu();
\r
45 if(config && config.value) {
\r
46 this.setValue(config.value);
\r
47 this.setActive(config.active !== false, true);
\r
48 delete config.value;
\r
51 Ext.extend(Ext.grid.filter.Filter, Ext.util.Observable, {
\r
53 * @cfg {Boolean} active
\r
54 * Indicates the default status of the filter (defaults to false).
\r
57 * True if this filter is active. Read-only.
\r
63 * @cfg {String} dataIndex
\r
64 * The {@link Ext.data.Store} data index of the field this filter represents. The dataIndex does not actually
\r
65 * have to exist in the store.
\r
69 * The filter configuration menu that will be installed into the filter submenu of a column menu.
\r
70 * @type Ext.menu.Menu
\r
76 * Initialize the filter and install required menu items.
\r
80 fireUpdate: function() {
\r
81 this.value = this.item.getValue();
\r
84 this.fireEvent("update", this);
\r
86 this.setActive(this.value.length > 0);
\r
90 * Returns true if the filter has enough configuration information to be activated.
\r
93 isActivatable: function() {
\r
98 * Sets the status of the filter and fires that appropriate events.
\r
99 * @param {Boolean} active The new filter state.
\r
100 * @param {Boolean} suppressEvent True to prevent events from being fired.
\r
102 setActive: function(active, suppressEvent) {
\r
103 if(this.active != active) {
\r
104 this.active = active;
\r
105 if(suppressEvent !== true) {
\r
106 this.fireEvent(active ? 'activate' : 'deactivate', this);
\r
112 * Get the value of the filter
\r
113 * @return {Object} The 'serialized' form of this filter
\r
115 getValue: Ext.emptyFn,
\r
118 * Set the value of the filter.
\r
119 * @param {Object} data The value of the filter
\r
121 setValue: Ext.emptyFn,
\r
124 * Serialize the filter data for transmission to the server.
\r
125 * @return {Object/Array} An object or collection of objects containing key value pairs representing
\r
126 * the current configuration of the filter.
\r
128 serialize: Ext.emptyFn,
\r
131 * Validates the provided Ext.data.Record against the filters configuration.
\r
132 * @param {Ext.data.Record} record The record to validate
\r
133 * @return {Boolean} True if the record is valid with in the bounds of the filter, false otherwise.
\r
135 validateRecord: function(){return true;}
\r