PDA

View Full Version : [CLOSED] ownerCt issue in Ext.Button within menu



dtex-lab
20 May 2010, 4:55 AM
Hi,
the ownerCt in Ext.Button within menu in not setted, and so is not possibile to recurse the owner's chain from bottom to top.

In this simple example you will see in firebug's console the print out : undefined

I except that the vMainButton's menu ownerCt is the vMainButton itself (but it is undefined)

What I'm doing wrong?



Ext.onReady(function () {
var vButton1 = new Ext.menu.Item({
text: 'Inner button'
});
var vMainButton = new Ext.Button({
text: 'Main button',
menu: [vButton1]
});
var vView = new Ext.Viewport({
renderTo: 'test-body',
items: [vMainButton]
});
console.info(vMainButton.menu.ownerCt);
});

jsakalos
20 May 2010, 12:17 PM
Try parentMenu instead of ownerCt.

dtex-lab
20 May 2010, 10:37 PM
Hi


console.info(vMainButton.menu.parentMenu);

prints out 'undefined' too

jsakalos
21 May 2010, 1:27 AM
It looks like a bug. Menu extends container and ownerCt property is documented, however, it is undefined in your example. Note: Menu is a bit different from other containers. Its el is not rendered within the container but in body and laying out its parent doesn't affect the menu itself. Anyway, moving this thread to bugs for explanation/fixing the issue.

Jamie Avins
21 May 2010, 10:37 AM
Looks like the reference isn't set until the menu is shown. This looks to be a design decision which allows a single menu to be "bound" to several buttons.

jsakalos
21 May 2010, 11:39 AM
Thank you for the explanation Jamie.