Results 1 to 6 of 6

Thread: Detect collapse state

  1. #1
    Ext User heidtmare's Avatar
    Join Date
    Mar 2007
    Location
    The Space Coast, FL
    Posts
    307

    Default Detect collapse state

    How do i check to see if a region is collapsed.
    I see an isVisible() but i cant find an isExpanded().

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854

    Default

    There is a property called 'collapsed'. Not sure if it's intended to be public. Also expand and collapse both fire a corresponding event, so you could keep track of it externally.

  3. #3

    Default

    You should be able to check the collapsed property of the region. I don't know of a method that will return the status.

  4. #4
    Ext User heidtmare's Avatar
    Join Date
    Mar 2007
    Location
    The Space Coast, FL
    Posts
    307

    Default

    thanks guys

    EDIT: Also found the region.visible boolean, so i wont use the isVisible() anymore.

  5. #5
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854

    Default

    If there's a public get/set method you should use that instead of directly accessing the property. While directly reading the visible property isn't going to hurt you now, it can lead you to assume that it's also OK to directly set the visible property. This would be bad, as it would bypass the rest of the functionality of the hide method. Only access the property when there's not a public accessor, and then you should question it's use if it's not marked public.

  6. #6

    Wink [A solution] Detect collapse state

    I was looking for a solution to this and here is what I came up with...in pieces

    Code:
            // choose a state provider
          Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
            
          var navigationCollapsed = Ext.state.Manager.get('Layout.Navigation.Collapsed', false);
    somewhere further along

    Code:
            this.mainLayout = new Ext.BorderLayout(document.body, {
                north: { 
                      split: false
                    , initialSize: 84 
                }, 
                west: { 
                      split: false
                    , id: 'navigation'
                    , initialSize: 200
                    , minSize: 200
                    , maxSize: 400
                    , titlebar: true
                    , collapsible: true
                    , collapsed: navigationCollapsed
                    , animate: true
                    , useShim:true
                    , cmargins: {top:2,bottom:2,right:2,left:2}
                }, 
                center: {titlebar: false}
            });
    the event handler

    Code:
            this.mainLayout.on('regioncollapsed', this.toggleNavigation, this); 
            this.mainLayout.on('regionexpanded', this.toggleNavigation, this);
    the toggle function

    Code:
            toggleNavigation:function (region)
            {
                if(this.mainLayout.getRegion('west') == region)
                {
                    Ext.state.Manager.set('Layout.Navigation.Collapsed', region.collapsed);  
                }            
            }

Similar Threads

  1. expand/collapse resizeing issues
    By heidtmare in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 30 Mar 2007, 12:18 PM
  2. Detect moment data grid is complete loaded
    By fnan11 in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 10 Mar 2007, 12:09 PM
  3. Collapse layout region on load
    By Tym in forum Ext 1.x: Help & Discussion
    Replies: 9
    Last Post: 17 Feb 2007, 9:20 PM
  4. Detect when document is completly loaded (even images)
    By pbrosset in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 1 Dec 2006, 6:08 AM
  5. 1) Edit and Select with EditorGrid. 2) Detect sorts in serve
    By galdaka in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 17 Oct 2006, 7:14 AM

Posting Permissions

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