Results 1 to 9 of 9

Thread: Help to diagnose problem on 'prepareItems' of AbstractContainer

  1. #1
    Sencha Premium Member
    Join Date
    Aug 2011
    Posts
    26
    Vote Rating
    0
      0  

    Default Help to diagnose problem on 'prepareItems' of AbstractContainer

    Hi all,

    I'm trying to diagnose a problem and I'm certain it's a timing issue. Sometimes it's happens and sometimes it's not.

    Basically I have a component that sits on TabPanel that is not visible yet. The initComponent method creates a new Toolbar with items and separators and several other components.

    And then, sometimes, I get a problem on 'prepareItems' of AbstractContainer:

    PHP Code:
                   item.isContained me;
                    
    items[i] = me.lookupComponent(item);
                   
    delete item.isContained;
    --->            
    delete items[i].isContained
    The 'item' that is being lookep up is '-' (a separator from the Toolbar). It appears that sometimes this item does not exist yet... and when it tries to clean the container during the initialization it gives an 'undefined' error. Is there a background process that creates this type of standard components ? How to guarantee that a separator is being created when adding a new component ?

    Unfortunately I could not isolated a minimum case to post. I'm sorry. But I was wondering if somebody has seen something similar and what can I do to debug, diagnose, etc.

    tks
    R.

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,062
    Vote Rating
    1390
      0  

    Default

    When you have the issue is it under a tab that hasn't been made active yet?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium Member
    Join Date
    Aug 2011
    Posts
    26
    Vote Rating
    0
      0  

    Default

    Yes. I have a controller and on the "init: function() { ..." I have something like:

    PHP Code:

    Ext
    .Function.defer(function() {
        
    this.getMyTab().add(
        { 
            
    xtype'mycomponent',
            
    region'center',
            
    title'Comp',
            
    itemId'tabcomp',
            
    closable false,
                
    tabConfig: { tooltip'My tip...' }
        });
    }, 
    500this); 
    I use 'defer' because there are a lot of tabs.

    The error I mentioned happened on a Toolbar that it's created on 'mycomponent'.

    tks
    RW

  4. #4
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,062
    Vote Rating
    1390
      0  

    Default

    By default the tab panel will not render items that have not yet been activated yet.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  5. #5
    Sencha Premium Member
    Join Date
    Aug 2011
    Posts
    26
    Vote Rating
    0
      0  

    Default

    I know. As I said previously, it works 99% of the time. Once in a while it fails. All this happens on the init event and none of the components have been rendered yet.

  6. #6
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,010
    Vote Rating
    940
      0  

    Default

    Does it only happen in Chrome?

    If so: http://code.google.com/p/chromium/is...tail?id=157520
    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.

  7. #7
    Sencha Premium Member
    Join Date
    Aug 2011
    Posts
    26
    Vote Rating
    0
      0  

    Default

    Good point. I can't say. Since this seems fixed on the next version and I'm using Chrome 23, I'll keep an eye on version 24 and see if they will merge it.

    tks!

  8. #8
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,010
    Vote Rating
    940
      0  

    Default

    In the interim you can change Toolbar:

    Code:
        lookupComponent: function(c) {
            var args = arguments;
            if (typeof c == 'string') {
                var T = Ext.toolbar.Toolbar,
                    shortcut = T.shortcutsHV[this.vertical ? 1 : 0][c] || T.shortcuts[c];
    
                if (typeof shortcut == 'string') {
                    c = {
                        xtype: shortcut
                    };
                } else if (shortcut) {
                    c = Ext.apply({}, shortcut);
                } else {
                    c = {
                        xtype: 'tbtext',
                        text: c
                    };
                }
    
                this.applyDefaults(c);
                
                // See: EXTJSIV-7578
                args = [c];
            }
    
            return this.callParent(args);
        }
    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.

  9. #9
    Sencha Premium Member
    Join Date
    Aug 2011
    Posts
    26
    Vote Rating
    0
      0  

    Default

    Awesome! EXTJSIV-7578 looks to be exactly the problem I'm facing!

    Applying the patch right now...



Posting Permissions

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