1. #1
    Sencha - Desktop Packager Dev Team jarrednicholls's Avatar
    Join Date
    Mar 2007
    Location
    Frederick, MD
    Posts
    1,747
    Vote Rating
    7
    jarrednicholls will become famous soon enough jarrednicholls will become famous soon enough

      0  

    Default LayoutRegion.hasPanel

    LayoutRegion.hasPanel


    Bug when you pass a panel object in, it's passing in the panel object itself into the MixedCollection "get" function (i.e. this.panels.get(id)) instead of its id (i.e. this.panels.get(panel.getId()) )...yes the parameter name is "id" for hasPanel, but I thought it was unintuitive to have to use the panel ID rather than the panel itself...so this isn't really a bug I guess. Bah, whatever :-)

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    This is what I have:

    Code:
    hasPanel : function(panel){
            return this.getPanel(panel) ? true : false;
        }
    And:

    Code:
    getPanel : function(id){
            if(typeof id == 'object'){ // must be panel obj
                return id;
            }
            return this.panels.get(id);
        }
    So if you pass in a panel object it should typeof to 'object' and return true. Is that the same code you have?

  3. #3
    Sencha - Desktop Packager Dev Team jarrednicholls's Avatar
    Join Date
    Mar 2007
    Location
    Frederick, MD
    Posts
    1,747
    Vote Rating
    7
    jarrednicholls will become famous soon enough jarrednicholls will become famous soon enough

      0  

    Default


    it sure is....but the problem is if the panel is closed/removed from a region and you're testing that region to see if the panel is still showing by using hasPanel, you get a false-positive.

    If there's another method I should use besides iterating through this.panels.items manually, let me know.

  4. #4
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    Good point. I will correct that.

  5. #5
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    Code:
    hasPanel : function(panel){
            if(typeof panel == 'object'){ // must be panel obj
                panel = panel.getId();
            }
            return this.getPanel(panel) ? true : false;
        }

  6. #6
    Sencha - Desktop Packager Dev Team jarrednicholls's Avatar
    Join Date
    Mar 2007
    Location
    Frederick, MD
    Posts
    1,747
    Vote Rating
    7
    jarrednicholls will become famous soon enough jarrednicholls will become famous soon enough

      0  

    Default


    Cool.

Similar Threads

  1. LayoutRegion and LayoutStateManager
    By stekolla in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 21 Mar 2007, 12:45 AM
  2. grid from tabpanelitem (in layoutregion)
    By seldon in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 8 Feb 2007, 5:09 AM
  3. Creating a custom LayoutRegion?
    By dlibby00 in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 6 Feb 2007, 12:08 PM
  4. Problem with LayoutRegion.setActivePanel ??
    By tryanDLS in forum Ext 1.x: Bugs
    Replies: 6
    Last Post: 15 Nov 2006, 9:15 PM

Thread Participants: 1