1. #1
    Ext User Starfall's Avatar
    Join Date
    Jan 2008
    Location
    Moscow, Russian Federation
    Posts
    158
    Vote Rating
    0
    Starfall is on a distinguished road

      0  

    Default [2.1][FIXED] Ext.Button::ownerCt

    [2.1][FIXED] Ext.Button::ownerCt


    It is clear that you can provide a real button instance for Panel config object. But, there is one point missing - ownerCt setting. Obviously, initComponent of Panel should be modified this way:
    Code:
    if(btns[i].render) {
        btns[i].ownerCt = this;
        this.buttons.push(btns[i]);    
    }

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,507
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    It's not really a Container->Component relationship. They are just Buttons rendered into the footer Element. But some way of "orientating" yourself given only the Button as a context is probably a good idea.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Location
    Austin, Texas
    Posts
    2
    Vote Rating
    0
    brian.moeskau is an unknown quantity at this point

      0  

    Default


    Yeah, it's not really that obvious. What would be the owner, the Panel (your suggestion) or the actual button container div, or the footer? Not really a bug. As Animal said, it's not part of the component / container hierarchy.

  4. #4
    Ext User Starfall's Avatar
    Join Date
    Jan 2008
    Location
    Moscow, Russian Federation
    Posts
    158
    Vote Rating
    0
    Starfall is on a distinguished road

      0  

    Default


    In addButton method the ownerCt property of button is set to this (the Panel). So, the real bug is inconsistency - adding button via its config or via direct instance differs in behavior.

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Location
    Austin, Texas
    Posts
    2
    Vote Rating
    0
    brian.moeskau is an unknown quantity at this point

      0  

    Default


    Good point. That's what I get for replying without looking at the code. Fixed in SVN.

  6. #6
    Sencha User
    Join Date
    Mar 2008
    Posts
    658
    Vote Rating
    0
    dirtdevil is on a distinguished road

      0  

    Default


    Can you please tell me how you fixed it? I just did an svn update and created a button (through config) in the tbar of a grid and I don't see anything that allows me to see the grid from within the botton. I did a console.log(this) and a console.log(the first arg) and theres no ownerCt or getOwner() method or anything like that. It looks the same. I found an id in the container obj but I can't Ext.getCmp it because it comes back undefined. Heres my code...


    PHP Code:
    Ext.global.GridPanel Ext.extend(Ext.grid.GridPanel, {
    //      width: 200
            
    initComponent:function() {
                    
    Ext.apply(this, {
                            
    tbar: [{
                                    
    text'testing',
                                    
    handler: function(a,b,c){
                                            
    debug(a);
                                            
    debug(b);
                                            
    debug(c);
                                            
    debug(this);
                                            
    debug(Ext.getCmp(this.container.id));
                                    }
                            }],
                            
    autoHeighttrue,
                            
    disableSelectionfalse,
                            
    enableColumnMovetrue,
                            
    enableColumnResizetrue
                    
    });
                    
    Ext.global.GridPanel.superclass.initComponent.apply(thisarguments);
            }, 
    onRender:function() {
                    
    Ext.global.GridPanel.superclass.onRender.apply(thisarguments);
            }
    });
    Ext.reg('globalgridpanel'Ext.global.EditorGridPanel); 

  7. #7
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,987
    Vote Rating
    649
    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


    This fix is specifically referring to the buttons config of a panel, not a toolbar.

    From memory Nige posted a workaround for this somewhere.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  8. #8
    Sencha User
    Join Date
    Mar 2008
    Posts
    658
    Vote Rating
    0
    dirtdevil is on a distinguished road

      0  

    Default


    Big fat duh on me, I didn't need the svn update. I can easily do a scope: this and just have it pipe in the tbar object which has an ownerCt in it which is the grid it's self.

    PHP Code:
    Ext.global.GridPanel Ext.extend(Ext.grid.GridPanel, {
    //      width: 200
            
    initComponent:function() {
                    
    Ext.apply(this, {
                            
    tbar: [{
                                    
    text'testing',
                                    
    handler: function(a,b,c){
                                            
    debug(a);
                                            
    debug(b);
                                            
    debug(c);
                                            
    debug(this);
                                            
    debug(Ext.getCmp(this.container.id));
                                    },
                                   [
    Bscopethis[/B]
                            }],
                            
    autoHeighttrue,
                            
    disableSelectionfalse,
                            
    enableColumnMovetrue,
                            
    enableColumnResizetrue
                    
    });
                    
    Ext.global.GridPanel.superclass.initComponent.apply(thisarguments);
            }, 
    onRender:function() {
                    
    Ext.global.GridPanel.superclass.onRender.apply(thisarguments);
            }
    });
    Ext.reg('globalgridpanel'Ext.global.EditorGridPanel);