1 goog.provide('Banana.Controls.DataGridTreeListNodeToggle'); 2 3 /** 4 * @author Gillis Haasnoot <gillis[at]vivesta[dot]com> 5 * @link www.vivesta.com 6 * @copyright Copyright © 2011 7 * @license xxx 8 * @version 0.0.1 9 * @package Banana 10 * 11 * Node toggle used in advanced datagrid tree list 12 * 13 */ 14 namespace('Banana.Controls').DataGridTreeListNodeToggle = Banana.Controls.Panel.extend({ 15 16 createComponents : function() 17 { 18 this.createImage(); 19 20 this.bind('click',this.getProxy(function(){ 21 22 this.on = this.on ? false : true; 23 24 this.triggerEvent('toggle',this.on); 25 26 this.createImage(); 27 })); 28 }, 29 30 createImage :function() 31 { 32 if (this.on) 33 { 34 this.removeCssClass("BDataGridTreeNodeClosed"); 35 this.addCssClass("BDataGridTreeNodeOpen"); 36 } 37 else 38 { 39 this.removeCssClass("BDataGridTreeNodeOpen"); 40 this.addCssClass("BDataGridTreeNodeClosed"); 41 } 42 }, 43 44 /** 45 * passive function (need to be set prior to render) 46 * 47 * @param {Boolean} bool 48 */ 49 setOn : function(bool) 50 { 51 this.on = bool; 52 53 return this; 54 } 55 });