1. #1
    Sencha Premium Member
    Join Date
    Aug 2011
    Posts
    23
    Vote Rating
    0
    reweiner is on a distinguished road

      0  

    Default Help to diagnose problem on 'prepareItems' of AbstractContainer

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    When you have the issue is it under a tab that hasn't been made active yet?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Aug 2011
    Posts
    23
    Vote Rating
    0
    reweiner is on a distinguished road

      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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    By default the tab panel will not render items that have not yet been activated yet.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha Premium Member
    Join Date
    Aug 2011
    Posts
    23
    Vote Rating
    0
    reweiner is on a distinguished road

      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 - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,006
    Vote Rating
    650
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Does it only happen in Chrome?

    If so: http://code.google.com/p/chromium/is...tail?id=157520
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  7. #7
    Sencha Premium Member
    Join Date
    Aug 2011
    Posts
    23
    Vote Rating
    0
    reweiner is on a distinguished road

      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 - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,006
    Vote Rating
    650
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      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);
        }
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  9. #9
    Sencha Premium Member
    Join Date
    Aug 2011
    Posts
    23
    Vote Rating
    0
    reweiner is on a distinguished road

      0  

    Default


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

    Applying the patch right now...



Thread Participants: 2