tags:

views:

185

answers:

2

Hi

Could someone tell me the preferred way of getting a reference a checkbox if its in a toolbar in an EditorGridPanel? I simply would like to call the getValue() on it so I can do stuff with it.

My EditorGridPanel is built similar to the one below (plus a few more config properties):

var grid = new Ext.grid.EditorGridPanel({    
tbar: new Ext.Toolbar({
      width: 200,
      height: 30,
      items: [
       {
        xtype: 'checkbox',
        name: 'field1',
        boxLabel: 'Order aktiverad'
       }
      ]
     })
 });

Thanks!

A: 

Can't you just give the checkbox an itemId, and use getCmp()?

timdev
+1  A: 

Thanks for the answer. Pushed me in the right direction; I didn't even know about getCmp().

Tried Ext.getCmp() with the itemId but it didn't find it. I gave it an id and that worked:

tbar: [
       {
        xtype: 'checkbox',
        name: 'field1',
        boxLabel: 'Order aktiverad',

        id : 'cb_order_active'
       },
       {
              //Button  
                    text: 'Test',
        handler : function(){
         alert(Ext.getCmp('cb_order_active').getValue());
        }
       }
      ]
Aicos