Ext.form.Checkbox 单击选中事件

如下代码,如何为该checkbox添加一个单击事件?越详细越好,谢谢!
......
......
var checkboxModule = new Ext.form.Checkbox({
id : "reportId",
name : "reportIDs",
autoScroll : false,
width : 90,
boxLabel : reportName,
inputValue : reportId,
anchor : "90%",
hideLabel : true,
//为checkbox添加选中事件
});

我昨晚试了一下修改CHECKBOX的CLICK事件,发现不是那吗好改的,

没事把代码贴出来让大伙研究研究,
也感觉出什么EXT不提供CLICK事件了
[code="js"]
Ext.getBody().update();

  var checkboxextend = Ext.extend(Ext.form.Checkbox,  {
   initComponent : function(){
    Ext.form.Checkbox.superclass.initComponent.call(this);
    this.addEvents(
        'click')},

  afterRender : function(){
  Ext.form.Checkbox.superclass.afterRender.call(this);

  this.on( 'click', this.onClick, this);
  },
  onClick : function(){
   this.fireEvent("click", this);
  }
  }
  );



    var dule = new checkboxextend({     
    checked : true,  

id : "reportId",

name : "reportIDs",

listeners : { "click" : function(obj,ischecked){alert('sdfsdfsd');}}

});

//dule.on('click',function(){alert('gamessss');});

var fp = new Ext.FormPanel({

frame: true,

title:'Check/Radio Groups',

labelWidth: 110,

width: 600,

renderTo:Ext.getBody(),

items : [dule],

bodyStyle: 'padding:0 10px 0;'});

[/code]

这个代码会当用户点击时发生死循环,一直ALERT,只能杀进程,所以说,use own your risk!!!!

不过对于你的情况可以这样处理

当你要动态附值时,先取消check事件
[code="js"]un( String eventName, Function handler, [Object scope] ) : void
Removes a listener (shorthand for removeListener)
Parameters:
eventName : String
The type of event to listen for
handler : Function
The handler to remove
scope : Object
(optional) The scope (this object) for the handler
Returns:
void[/code]
附完值后再
on 这 个check事件
[code="java"]on( String eventName, Function handler, [Object scope], [Object options] ) : void
Appends an event handler to this element (shorthand for addListener)
Parameters:
eventName : String
The type of event to listen for
handler : Function
The method the event invokes
scope : Object
(optional) The scope in which to execute the handler function. The handler function's "this" context.
options : Object
(optional)
Returns:
void[/code]

[code="js"]
var checkboxModule = new Ext.form.Checkbox({
id : "reportId",
name : "reportIDs",
autoScroll : false,
width : 90,
boxLabel : reportName,
inputValue : reportId,
anchor : "90%",
hideLabel : true,
listeners : { "check" : function(obj,ischecked){......}}
});

[/code]
然到要的是这样的效果?

Ext.form.Checkbox

本身就提供选中事件了吧。。。。。

[code="js"]

    Ext.getBody().update();


    var dule = new Ext.form.Checkbox({   
    checked : true,

id : "reportId",

name : "reportIDs",
listeners : { "check" : function(obj,ischecked){alert('sdfsdfsd');}}

});

//dule.on('click',function(){alert('gamessss');});
var fp = new Ext.FormPanel({
frame: true,
title:'Check/Radio Groups',
labelWidth: 110,
width: 600,
renderTo:Ext.getBody(),
items : [dule],
bodyStyle: 'padding:0 10px 0;'});

[/code]

我执行这段时默认选中,没有激活CHECK事件,,,,要不把你代贴出来研究下。。。,