Looks like we can't reproduce the issue or there's a problem in the test case provided.
-
Ext JS Premium Member
doLayout issue in Ext.menu.Menu
It worked in ExtJS 4.0.7, but was broken in 4.1.3 and is still broken in 4.2
PHP Code:
tb.add({
icon: 'preview.png',
cls: 'x-btn-text-icon',
text: 'Scrolling Menu',
menu: scrollMenu
});
to:
1st test case:
PHP Code:
// scrollable menu
var btn = tb.add({
icon: 'preview.png',
cls: 'x-btn-text-icon',
text: 'Scrolling Menu',
menu: scrollMenu
});
setTimeout(function() {
btn.showMenu();
}, 1000);
setTimeout(function() {
scrollMenu.removeAll();
scrollMenu.add({ text: 'test item' });
scrollMenu.doLayout();
}, 3000);
In this test case you will see full menu after 1 sec. and "detached" item after 3 secs. which will be at top (where first menu item of full menu was)
2st test case:
PHP Code:
// scrollable menu
var btn = tb.add({
icon: 'preview.png',
cls: 'x-btn-text-icon',
text: 'Scrolling Menu',
menu: scrollMenu
});
setTimeout(function() {
btn.showMenu();
}, 1000);
setTimeout(function() {
scrollMenu.doLayout();
}, 3000);
In this test case scrollers will be disappeared
I think it's some troubles with menu height and shrinkWrap property of its layout.
First snippet effect:
2013-03-20_22-37-07.png
Second snippet effect:
2013-03-20_22-39-47.jpg
Supposed to be like this:
2013-03-20_22-40-53.png
-
I don't really see a problem here. The menu positions itself when it's triggered by the button. When you add new items and trigger a layout, you're asking the menu to do something independently.
If you want the menu to reposition, then hide it and show it again.
Code:
var btn = tb.add({
icon: 'preview.png',
cls: 'x-btn-text-icon',
text: 'Scrolling Menu',
menu: scrollMenu
});
setTimeout(function() {
btn.showMenu();
}, 1000);
setTimeout(function() {
btn.hideMenu();
scrollMenu.removeAll();
scrollMenu.add({ text: 'test item' });
btn.showMenu();
}, 3000);
-
Ext JS Premium Member
It's very slow in long menus. In ExtJS 2 you can easily add and remove items without hiding and showing menu after. You can to do it in 4.0 too. Why can't I to do it in 4.2?