2 * @class Ext.ux.grid.filter.NumericFilter
3 * @extends Ext.ux.grid.filter.Filter
4 * Filters using an Ext.ux.grid.menu.RangeMenu.
5 * <p><b><u>Example Usage:</u></b></p>
7 var filters = Ext.create('Ext.ux.grid.GridFilters', {
15 * <p>Any of the configuration options for {@link Ext.ux.grid.menu.RangeMenu} can also be specified as
16 * configurations to NumericFilter, and will be copied over to the internal menu instance automatically.</p>
18 Ext.define('Ext.ux.grid.filter.NumericFilter', {
19 extend: 'Ext.ux.grid.filter.Filter',
20 alias: 'gridfilter.numeric',
21 uses: ['Ext.form.field.Number'],
25 * Creates the Menu for this filter.
26 * @param {Object} config Filter configuration
27 * @return {Ext.menu.Menu}
29 createMenu: function(config) {
32 menu = Ext.create('Ext.ux.grid.menu.RangeMenu', config);
33 menu.on('update', me.fireUpdate, me);
39 * Template method that is to get and return the value of the filter.
40 * @return {String} The value of this filter
42 getValue : function () {
43 return this.menu.getValue();
48 * Template method that is to set the value of the filter.
49 * @param {Object} value The value to set the filter
51 setValue : function (value) {
52 this.menu.setValue(value);
57 * Template method that is to return <tt>true</tt> if the filter
58 * has enough configuration information to be activated.
61 isActivatable : function () {
62 var values = this.getValue(),
65 if (values[key] !== undefined) {
74 * Template method that is to get and return serialized filter data for
75 * transmission to the server.
76 * @return {Object/Array} An object or collection of objects containing
77 * key value pairs representing the current configuration of the filter.
79 getSerialArgs : function () {
82 values = this.menu.getValue();
94 * Template method that is to validate the provided Ext.data.Record
95 * against the filters configuration.
96 * @param {Ext.data.Record} record The record to validate
97 * @return {Boolean} true if the record is valid within the bounds
98 * of the filter, false otherwise.
100 validateRecord : function (record) {
101 var val = record.get(this.dataIndex),
102 values = this.getValue(),
103 isNumber = Ext.isNumber;
104 if (isNumber(values.eq) && val != values.eq) {
107 if (isNumber(values.lt) && val >= values.lt) {
110 if (isNumber(values.gt) && val <= values.gt) {