+++ /dev/null
-/*\r
- * Ext JS Library 2.2.1\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
- */\r
-\r
-Ext.grid.filter.BooleanFilter = Ext.extend(Ext.grid.filter.Filter, {\r
- /**\r
- * @cfg {Boolean} defaultValue\r
- * The default value of this filter (defaults to false)\r
- */\r
- defaultValue: false,\r
- /**\r
- * @cfg {String} yesText\r
- * The text displayed for the "Yes" checkbox\r
- */\r
- yesText: 'Yes',\r
- /**\r
- * @cfg {String} noText\r
- * The text displayed for the "No" checkbox\r
- */\r
- noText: 'No',\r
-\r
- init: function(){\r
- var gId = Ext.id();\r
- this.options = [\r
- new Ext.menu.CheckItem({text: this.yesText, group: gId, checked: this.defaultValue === true}),\r
- new Ext.menu.CheckItem({text: this.noText, group: gId, checked: this.defaultValue === false})\r
- ];\r
- \r
- this.menu.add(this.options[0], this.options[1]);\r
- \r
- for(var i=0; i<this.options.length; i++) {\r
- this.options[i].on('click', this.fireUpdate, this);\r
- this.options[i].on('checkchange', this.fireUpdate, this);\r
- }\r
- },\r
- \r
- isActivatable: function() {\r
- return true;\r
- },\r
- \r
- fireUpdate: function() { \r
- this.fireEvent("update", this); \r
- this.setActive(true);\r
- },\r
- \r
- setValue: function(value) {\r
- this.options[value ? 0 : 1].setChecked(true);\r
- },\r
- \r
- getValue: function() {\r
- return this.options[0].checked;\r
- },\r
- \r
- serialize: function() {\r
- var args = {type: 'boolean', value: this.getValue()};\r
- this.fireEvent('serialize', args, this);\r
- return args;\r
- },\r
- \r
- validateRecord: function(record) {\r
- return record.get(this.dataIndex) == this.getValue();\r
- }\r
-});
\ No newline at end of file