2012-07-09 65 views
4

我需要添加Check box,並且當它的用戶checks(如在更改值check/uncheck)打印console.log語句。到目前爲止,我能夠顯示覆選框,但無法訪問其檢查事件。複選框,動作事件

{ 
    xtype: 'checkboxgroup', 
    columns: 1, 

    listeners: { 
     change: function (this, newValue, oldValue, eOpts) { 
      console.log('change'); 
      console.log(newValue); 
     } 
    }, 
    items: [{ 
     boxLabel: 'Cars', 
     name: 'chk1', 
     inputValue: '1' 
    }] 
} 

回答

5

至於任何其他字段,change事件應該工作。

示例:http://jsfiddle.net/mbbjz/2/

+0

如何獲取單擊的複選框的值。我得到這個'\t 改變:函數(this,newValue,oldValue,eOpts){'和我得到一個錯誤'缺少形式參數'。我想我錯過了什麼。 – 2012-07-09 12:57:23

+0

@RazairoAluguera:你可以在問題中更新你的代碼嗎? – 2012-07-09 12:58:29

+0

我已更新我的代碼。 – 2012-07-09 13:00:59