PDA

View Full Version : colorMenu error when using id



ValterBorges
4 Aug 2009, 9:30 AM
While working with the menu/toolbar sample i found that if I create a colorMenu without an id just like the example everything works, but as soon as i give it an id it throws an error. As soon as give it an id it crashes at the following line in the ext-debug.js file (line 50,215):

This can be reproduced by editing the sample menu.js in the examples/menu folder line 54 just give the colorMenu an id.





// Valid if the Component is in a <li> which is part of our target <ul>
isValidParent: function(c, target) {
return c.el.up('li.x-menu-list-item', 5).dom.parentNode === (target.dom || target);
},




The relevant htm



<div id='dMainMenu'></div>



The relevant javascript




var colorMenu = new Ext.menu.ColorMenu(
{
id:'ColorMenu1' //only works if i remove the id
});


//Define a Menu Programatically thru methods of the menu object
var Menu3 = new Ext.menu.Menu(
{
id:'Menu3',
items:[
{
text: 'Choose a Color',
menu: colorMenu // <-- submenu by reference
}
]
}
);

var btMenu3 = new Ext.Button(
{
id:'btMenu3',
width:20,
text:'Menu3',
menu:Menu3
}
);




var tbMainMenu = new Ext.Toolbar(
{
id:'tbMainMenu'
}
);

tbMainMenu.render('dMainMenu');

tbMainMenu.add(btMenu3);

tbMainMenu.doLayout();




Anyone run into this before ?

Thanks in advance.

17 Aug 2009, 5:17 AM
This is a bug:

to reproduce, paste in firebug:


var colorMenu = new Ext.menu.ColorMenu(
{
id:'ColorMenu1' //only works if i remove the id
});



colorMenu.showAt([100,100])

17 Aug 2009, 5:22 AM
Bug posted: http://extjs.com/forum/showthread.php?t=77823