2013-10-02 209 views
0

我有兩組按鈕(在Extjs 4.1中),在一次只能檢查一個按鈕。問題是我想在開始時檢查其中的一個(當網格加載時)。代碼如下:默認情況下選擇按鈕extjs4.1

{ 
    xtype : 'checkboxgroup', 
    store : checked, 
    columns : 3, 
    vertical : false, 
    singleSelect: true, 
    items : [ 
     { 
     xtype: 'button', 
     text: 'name', 
     width: 75, 
     toggleGroup: 'mygroup', 
     enableToggle: true, 
     listeners: { 
       click: function(th) { 
       //this == the button, as we are in the local scope 
        checked = [1,0,0]; 
       }} 
     }, { 
     xtype: 'button', 
     text: 'buyer_member_id', 
     width:100, 
     toggleGroup: 'mygroup', 
     enableToggle: true, 
     listeners: { 
       click: function(th) { 
       //this == the button, as we are in the local scope 
        checked = [0,1,0]; 
       }} 
     }, { 
     xtype: 'button', 
     text: 'id', 
     width: 50, 
     toggleGroup: 'mygroup', 
     enableToggle: true, 
     listeners: { 
        click: function(th) { 
       //this == the button, as we are in the local scope 
        checked = [0,0,1]; 
       }} 
     } 
    ]} 

我發現了一些幫助in the Sencha forum但我無法解決問題。

回答

0

這是這個詞:

pressed: true, 

要在按鈕配置指令被插入。

+0

而且[this](http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.button.Button)是我從中獲得的手冊。 – softwareplay