1 /** 2 * @author Gillis Haasnoot <gillis.haasnoot@gmail.com> 3 * @package Banana.Controls 4 * @summary DataGridCheckboxFilter 5 */ 6 7 goog.provide('Banana.Controls.DataGridCheckboxFilter'); 8 9 goog.require('Banana.Controls.BaseDataGridFilter'); 10 11 /** @namespace Banana.Controls.DataGridCheckboxFilter */ 12 namespace('Banana.Controls').DataGridCheckboxFilter = Banana.Controls.BaseDataGridFilter.extend( 13 /** @lends Banana.Controls.DataGridCheckboxFilter.prototype */ 14 { 15 /** 16 * Creates a datagrid checkbox filter. 17 * 18 * @constructs 19 * @extends Banana.Controls.BaseDataGridFilter 20 */ 21 init : function() 22 { 23 this._super(); 24 25 this.checkbox = new Banana.Controls.CheckBox(); 26 27 this.addCssClass('BDataGridPagerFilter') 28 29 this.checkbox.bind('change', this.getProxy(function() { this.triggerEvent('filterDataChanged'); })); 30 this.label = new Banana.Controls.Label(); 31 }, 32 33 /** 34 * @ignore 35 */ 36 createComponents: function() 37 { 38 this.addControl(this.checkbox); 39 this.addControl(this.label); 40 }, 41 42 /** 43 * @override to apply on checkbox 44 * @ignore 45 */ 46 setData: function(data,ignoreEvent,ignoreDom) 47 { 48 this.checkbox.setData(data, ignoreEvent, ignoreDom); 49 }, 50 51 /** 52 * @ignore 53 */ 54 getData: function() 55 { 56 return this.checkbox.getData(); 57 }, 58 59 /** 60 * Set title on label before checkbox 61 * @param {String} text 62 * @return {this} 63 */ 64 setTitle : function(text) 65 { 66 this.label.setData(text); 67 return this; 68 }, 69 70 /** 71 * @return {String} 72 */ 73 getTitle : function() 74 { 75 return this.label.getData(); 76 }, 77 78 /** 79 * This filter doesnt have a all key. its a checkbox with just 2 states 80 * @return {null} 81 */ 82 getAllKey : function() 83 { 84 return null; 85 } 86 });