Results 1 to 7 of 7

Thread: [FIXED-489][3.0/2.2] Ext.Menu.addElement bug

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User jclawson's Avatar
    Join Date
    Mar 2007
    Location
    Denver, Colorado
    Posts
    145
    Vote Rating
    1
      0  

    Default [FIXED-489][3.0/2.2] Ext.Menu.addElement bug

    I don't think the addElement function works as documented. addElement fails to move the DOM element into the menu list. This is because the menu item component is prematurely rendered in the instantiation of BaseItem.

    When you call Ext.Menu.addElement, it creates a new BaseItem with that element as its argument. This constructs a new Ext.Component with this element as its argument. Ext.Component will call Ext.Component.applyToMarkup with that element. This in turn "renders" the element keeping it in its original position. Since, the "rendered" flag is now set to true, the call to the Menu.addItem function (that moves the DOM element by calling render with the correct list-item parent ) will fail to do its job. The call to render (item.render(li, this) will just return without doing any work since the component was already rendered.

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,233
    Vote Rating
    1012
      0  

    Default

    Confirmed. You could try the following:

    Code:
    Ext.menu.BaseItem = function(config) {
        if(config.tagName || config.dom || typeof config == "string") {
            this.el = Ext.get(config);
            this.el.addClass('x-hide-' + this.hideMode);
            config = {};
        }
        Ext.menu.BaseItem.superclass.constructor.call(this, config);
    
        this.addEvents(
                'click',
                'activate',
                'deactivate'
            );
    
        if(this.handler) {
            this.on("click", this.handler, this.scope);
        }
    };
    And also add autoShow: true to the BaseItem config.
    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
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    0
      0  

    Default

    This has come up again here http://extjs.com/forum/showthread.php?p=319872

    Is this considered to be working as designed or a bug that slipped thru the cracks?

  4. #4
    Ext User
    Join Date
    Jan 2010
    Posts
    2
    Vote Rating
    0
      0  

    Default

    This is still broken using ExtJs 3.0. Any idea when the suggested fix could get added?

  5. #5
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
      0  

    Default

    [ moved to 3.x Bugs from 2.x Bugs ]
    note: bug reportedly affects both 2.x and 3.x branches

  6. #6
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    19
      0  

    Default

    Getting this entered into our tracker to make sure it gets addressed. Looks like there was no feedback as to the efficacy of the proposed solution. Referenced thread seems to have a good test case.

  7. #7
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,233
    Vote Rating
    1012
      0  

    Default

    A fix for this has been added into SVN for both branches, rev #5959 in 3.x trunk.
    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.

Posting Permissions

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