Results 1 to 3 of 3

Thread: doLayout issue in Ext.menu.Menu

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Ext JS Premium Member
    Join Date
    Jul 2007
    Posts
    219

    Exclamation 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',
            
    menuscrollMenu
        
    }); 
    to:
    1st test case:

    PHP Code:
       // scrollable menu
        
    var btn tb.add({
            
    icon'preview.png',
            
    cls'x-btn-text-icon',
            
    text'Scrolling Menu',
            
    menuscrollMenu
        
    });
        
    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',
            
    menuscrollMenu
        
    });
        
    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

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,256

    Default

    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);
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Ext JS Premium Member
    Join Date
    Jul 2007
    Posts
    219

    Default

    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?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •