X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/docs/source/BooleanFilter.html diff --git a/docs/source/BooleanFilter.html b/docs/source/BooleanFilter.html new file mode 100644 index 00000000..8d9c3bf9 --- /dev/null +++ b/docs/source/BooleanFilter.html @@ -0,0 +1,106 @@ + +
+/** + * @class Ext.ux.grid.filter.BooleanFilter + * @extends Ext.ux.grid.filter.Filter + * Boolean filters use unique radio group IDs (so you can have more than one!) + *+ + \ No newline at end of fileExample Usage:
+ *+ */ +Ext.ux.grid.filter.BooleanFilter = Ext.extend(Ext.ux.grid.filter.Filter, { + /** + * @cfg {Boolean} defaultValue + * Set this to null if you do not want either option to be checked by default. Defaults to false. + */ + defaultValue : false, + /** + * @cfg {String} yesText + * Defaults to 'Yes'. + */ + yesText : 'Yes', + /** + * @cfg {String} noText + * Defaults to 'No'. + */ + noText : 'No', + + /** + * @private + * Template method that is to initialize the filter and install required menu items. + */ + init : function (config) { + var gId = Ext.id(); + this.options = [ + new Ext.menu.CheckItem({text: this.yesText, group: gId, checked: this.defaultValue === true}), + new Ext.menu.CheckItem({text: this.noText, group: gId, checked: this.defaultValue === false})]; + + this.menu.add(this.options[0], this.options[1]); + + for(var i=0; i+var filters = new Ext.ux.grid.GridFilters({ + ... + filters: [{ + // required configs + type: 'boolean', + dataIndex: 'visible' + + // optional configs + defaultValue: null, // leave unselected (false selected by default) + yesText: 'Yes', // default + noText: 'No' // default + }] +}); + *
/** + * Template method that is to validate the provided Ext.data.Record + * against the filters configuration. + * @param {Ext.data.Record} record The record to validate + * @return {Boolean} true if the record is valid within the bounds + * of the filter, false otherwise. + */ + validateRecord : function (record) { + return record.get(this.dataIndex) == this.getValue(); + } +});