2012-07-09 62 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