Ext


Go Back   Ext JS Forums > Ext JS Community Forums (3.0) > Ext: Bugs

Reply
 
Thread Tools
  #1  
Old 11-05-2009, 03:59 AM
Condor's Avatar
Condor Condor is offline
Ext JS - Community Support Team
 
Join Date: Mar 2007
Location: The Netherlands
Posts: 14,250
Condor is on a distinguished road
Default [3.0+] CheckItem fires beforecheckchange for initial value

CheckItem fires a beforecheckchange event when the item is initially checked.

Example:
new Ext.Button({
    text: 'Click me',
    menu: [{
        text: 'Item',
        checked: true,
        listeners: {
            beforecheckchange: function(){
                console.log('Don't call me');
            }
        }
    }],
    renderTo: Ext.getBody()
});
Suggested fix:
Ext.override(Ext.menu.CheckItem, {
    setChecked : function(state, suppressEvent){
        if(this.checked != state &&
            (suppressEvent === true || this.fireEvent("beforecheckchange", this, state) !== false)){
            if(this.container){
                this.container[state ? "addClass" : "removeClass"]("x-menu-item-checked");
            }
            this.checked = state;
            if(suppressEvent !== true){
                this.fireEvent("checkchange", this, state);
            }
        }
    }
});
__________________
Condor
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 02:50 AM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.