-
21 May 2010 11:35 AM #1
MenuItem autoRef
MenuItem autoRef
Hi there,
i try to add a handler to an MenuItem via its reference but it seems there is no reference added to the viewport? Am i missing something?
here is my code:
the viewport ui:
the viewport instance:Code:ViewportUi = Ext.extend(Ext.Viewport, { layout: 'border', initComponent: function() { this.items = [ { xtype: 'panel', region: 'center', layout: 'card', activeItem: 0, ref: 'contentPanel', tbar: { xtype: 'toolbar', items: [ { xtype: 'button', text: 'MyButton', ref: '../../buttonRef', menu: { xtype: 'menu', items: [ { xtype: 'menuitem', text: 'Menu Item', ref: '../../../../menuItemRef' } ] } } ] } } ]; ViewportUi.superclass.initComponent.call(this); } });
thank you for your helpCode:Viewport = Ext.extend(ViewportUi, { initComponent: function() { Viewport.superclass.initComponent.call(this); console.log(this.contentPanel);//works for the Panel console.log(this.buttonRef);//works for the Button console.log(this.menuItemRef);//doesnt work for the MenuItem } });
-
21 May 2010 11:55 AM #2Sencha - Desktop Packager Dev Team
- Join Date
- Mar 2007
- Location
- Baltimore, MD.
- Posts
- 1,745
- Vote Rating
- 6
I believe this may be a bug or omission in ExtJS proper. I'm not able to get ref's to work for buttons inside of a menu that's tied to a button. I will put in a bug ticket for you.
-
21 May 2010 12:02 PM #3
thank your for the quick information.
is there a handy workaround, or there another 'easy' way to add an without using ids?
-
22 May 2010 4:02 PM #4
I am having the same issue
-
22 May 2010 6:17 PM #5Sencha - Desktop Packager Dev Team
- Join Date
- Mar 2007
- Location
- Baltimore, MD.
- Posts
- 1,745
- Vote Rating
- 6
I would resort to component ids as a for-sure workaround at this point. I am going to post a monkey-patch to Ext JS in a few minutes.
EDIT:
Here's a monkey patch that fixes the issue. I typically put these types of overrides in an ext-overrides.js file and include that just after I include Ext (i.e. ext-all.js).
This code only works if the menu is configured as an xtype object (such as the above case), it won't help menus configured as an array of items. The Designer doesn't generate the latter...
Code:Ext.Button.prototype.initComponent = Ext.Button.prototype.initComponent.createInterceptor(function(){ if (this.menu){ this.menu.ownerCt = this; } });
-
22 May 2010 9:41 PM #6
Nice fix ... thanks!
-
26 Oct 2010 1:27 AM #7Ext JS Premium Member
- Join Date
- Jan 2010
- Location
- Rotterdam, The Netherlands
- Posts
- 383
- Vote Rating
- 8
I believe this problem still exists with Ext JS 3.3.0 and the monkey fix still works.
Christiaan Westerbeek @ Devotis
STOIC ninja, Ext JS expert, Google Apps reseller, Marketing technologist
-
29 Nov 2010 11:34 AM #8Sencha - Desktop Packager Dev Team
- Join Date
- Mar 2007
- Location
- Baltimore, MD.
- Posts
- 1,745
- Vote Rating
- 6
putting in a permanent fix for 3.3.1
-
2 Dec 2010 7:18 AM #9
Did the fix make it to the final release of 3.3.1? I just installed it and it still behaves the same.
-
2 Dec 2010 9:46 AM #10Sencha - Desktop Packager Dev Team
- Join Date
- Mar 2007
- Location
- Baltimore, MD.
- Posts
- 1,745
- Vote Rating
- 6
It would appear not, I don't think it was merged. It'll be in 3.3.2 in that case. Sorry!
Similar Threads
-
MenuItem Event
By rizla in forum Ext GWT: Help & Discussion (1.x)Replies: 12Last Post: 10 Oct 2010, 2:28 AM -
Ref, autoRef, and name
By firefoxSafari in forum Ext Designer: Help & DiscussionReplies: 3Last Post: 19 Apr 2010, 4:32 PM -
[CLOSED-100] Field 'autoref' should not be allowed with toolbars
By ExtKD in forum Ext Designer: BugsReplies: 1Last Post: 15 Apr 2010, 10:09 AM -
[FIXED] MenuItem delete on click of the MenuiTem icon throwing a null pointer ex
By jennygandra in forum Ext GWT: Bugs (2.x)Replies: 5Last Post: 21 Dec 2009, 2:25 AM -
can 2 menus use one menuItem
By aj3423 in forum Ext 3.x: Help & DiscussionReplies: 3Last Post: 19 May 2009, 12:24 AM


Reply With Quote