source: trunk/web/addons/job_monarch/lib/extjs/examples/grid-filtering/grid/filter/NumericFilter.js @ 619

Last change on this file since 619 was 619, checked in by ramonb, 15 years ago

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 1.3 KB
Line 
1/*
2 * Ext JS Library 2.2.1
3 * Copyright(c) 2006-2009, Ext JS, LLC.
4 * licensing@extjs.com
5 *
6 * http://extjs.com/license
7 */
8
9Ext.grid.filter.NumericFilter = Ext.extend(Ext.grid.filter.Filter, {
10        init: function() {
11                this.menu = new Ext.menu.RangeMenu();
12               
13                this.menu.on("update", this.fireUpdate, this);
14        },
15       
16        fireUpdate: function() {
17                this.setActive(this.isActivatable());
18                this.fireEvent("update", this);
19        },
20       
21        isActivatable: function() {
22                var value = this.menu.getValue();
23                return value.eq !== undefined || value.gt !== undefined || value.lt !== undefined;
24        },
25       
26        setValue: function(value) {
27                this.menu.setValue(value);
28        },
29       
30        getValue: function() {
31                return this.menu.getValue();
32        },
33       
34        serialize: function() {
35                var args = [];
36                var values = this.menu.getValue();
37                for(var key in values) {
38                        args.push({type: 'numeric', comparison: key, value: values[key]});
39    }
40                this.fireEvent('serialize', args, this);
41                return args;
42        },
43       
44        validateRecord: function(record) {
45                var val = record.get(this.dataIndex),
46                        values = this.menu.getValue();
47                       
48                if(values.eq != undefined && val != values.eq) {
49                        return false;
50    }
51                if(values.lt != undefined && val >= values.lt) {
52                        return false;
53    }
54                if(values.gt != undefined && val <= values.gt) {
55                        return false;
56    }
57                return true;
58        }
59});
Note: See TracBrowser for help on using the repository browser.