X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..2e847cf21b8ab9d15fa167b315ca5b2fa92638fc:/docs/source/CheckItem.html diff --git a/docs/source/CheckItem.html b/docs/source/CheckItem.html index f05be33f..7cdb3902 100644 --- a/docs/source/CheckItem.html +++ b/docs/source/CheckItem.html @@ -1,5 +1,6 @@ + The source code @@ -14,37 +15,7 @@ * @param {Object} config Configuration options * @xtype menucheckitem */ -Ext.menu.CheckItem = function(config){ - Ext.menu.CheckItem.superclass.constructor.call(this, config); - this.addEvents( -
/** - * @event beforecheckchange - * Fires before the checked value is set, providing an opportunity to cancel if needed - * @param {Ext.menu.CheckItem} this - * @param {Boolean} checked The new checked value that will be set - */ - "beforecheckchange" , -
/** - * @event checkchange - * Fires after the checked value has been set - * @param {Ext.menu.CheckItem} this - * @param {Boolean} checked The checked value that was set - */ - "checkchange" - ); -
/** - * A function that handles the checkchange event. The function is undefined by default, but if an implementation - * is provided, it will be called automatically when the checkchange event fires. - * @param {Ext.menu.CheckItem} this - * @param {Boolean} checked The checked value that was set - * @method checkHandler - */ - if(this.checkHandler){ - this.on('checkchange', this.checkHandler, this.scope); - } - Ext.menu.MenuMgr.registerCheckable(this); -}; -Ext.extend(Ext.menu.CheckItem, Ext.menu.Item, { +Ext.menu.CheckItem = Ext.extend(Ext.menu.Item, {
/** * @cfg {String} group * All check items with the same group name will automatically be grouped into a single-select @@ -68,6 +39,37 @@ Ext.extend(Ext.menu.CheckItem, Ext.menu.Item, { // private ctype: "Ext.menu.CheckItem", + + initComponent : function(){ + Ext.menu.CheckItem.superclass.initComponent.call(this); + this.addEvents( +
/** + * @event beforecheckchange + * Fires before the checked value is set, providing an opportunity to cancel if needed + * @param {Ext.menu.CheckItem} this + * @param {Boolean} checked The new checked value that will be set + */ + "beforecheckchange" , +
/** + * @event checkchange + * Fires after the checked value has been set + * @param {Ext.menu.CheckItem} this + * @param {Boolean} checked The checked value that was set + */ + "checkchange" + ); +
/** + * A function that handles the checkchange event. The function is undefined by default, but if an implementation + * is provided, it will be called automatically when the checkchange event fires. + * @param {Ext.menu.CheckItem} this + * @param {Boolean} checked The checked value that was set + * @method checkHandler + */ + if(this.checkHandler){ + this.on('checkchange', this.checkHandler, this.scope); + } + Ext.menu.MenuMgr.registerCheckable(this); + }, // private onRender : function(c){ @@ -93,12 +95,13 @@ Ext.extend(Ext.menu.CheckItem, Ext.menu.Item, { * @param {Boolean} suppressEvent (optional) True to prevent the checkchange event from firing (defaults to false) */ setChecked : function(state, suppressEvent){ - if(this.checked != state && this.fireEvent("beforecheckchange", this, state) !== false){ + var suppress = suppressEvent === true; + if(this.checked != state && (suppress || this.fireEvent("beforecheckchange", this, state) !== false)){ if(this.container){ this.container[state ? "addClass" : "removeClass"]("x-menu-item-checked"); } this.checked = state; - if(suppressEvent !== true){ + if(!suppress){ this.fireEvent("checkchange", this, state); } }