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.grid.filter.BooleanFilter = Ext.extend(Ext.grid.filter.Filter, {
\r
11 * @cfg {Boolean} defaultValue
\r
12 * The default value of this filter (defaults to false)
\r
14 defaultValue: false,
\r
16 * @cfg {String} yesText
\r
17 * The text displayed for the "Yes" checkbox
\r
21 * @cfg {String} noText
\r
22 * The text displayed for the "No" checkbox
\r
29 new Ext.menu.CheckItem({text: this.yesText, group: gId, checked: this.defaultValue === true}),
\r
30 new Ext.menu.CheckItem({text: this.noText, group: gId, checked: this.defaultValue === false})
\r
33 this.menu.add(this.options[0], this.options[1]);
\r
35 for(var i=0; i<this.options.length; i++) {
\r
36 this.options[i].on('click', this.fireUpdate, this);
\r
37 this.options[i].on('checkchange', this.fireUpdate, this);
\r
41 isActivatable: function() {
\r
45 fireUpdate: function() {
\r
46 this.fireEvent("update", this);
\r
47 this.setActive(true);
\r
50 setValue: function(value) {
\r
51 this.options[value ? 0 : 1].setChecked(true);
\r
54 getValue: function() {
\r
55 return this.options[0].checked;
\r
58 serialize: function() {
\r
59 var args = {type: 'boolean', value: this.getValue()};
\r
60 this.fireEvent('serialize', args, this);
\r
64 validateRecord: function(record) {
\r
65 return record.get(this.dataIndex) == this.getValue();
\r