Results 1 to 3 of 3

Thread: accordin rendering

  1. #1
    Ext JS Premium Member
    Join Date
    Feb 2010
    Location
    Vancouver, BC
    Posts
    224
    Vote Rating
    1
      0  

    Default accordin rendering

    I am saving last open accordion tab into cookie, and expand when page load
    as below.

    The second accordion expands fine, but first item cannot be opened anymore. If you remove the expand code, accordion works fine.
    Is there any method that opens accordion item other than expand ? or is it a bug ?

    listeners:
    {
    "afterrender":function()
    {
    var activeItem = Ext.getCmp("accordion_2"); //the last expanded item
    if (activeItem)
    activeItem.expand();
    }
    }


    Code:
    Ext.onReady(function()
      {
    
    
        var myBorderPanel = Ext.create("Ext.container.Viewport",
          {
            layout: "border",
            margin:"0 0 0 0",
            defaults:{border:false,header:false,defaults:{border:false}},
            items: [
              {
                id:"westPanel",
                region: "west",
                collapsible: true,
                collapseMode : "mini",
                split: true,         // enable resizing
                layout:"fit",
                width:250,
                items:[
                  {
                    xtype:"panel",
                    layout:"accordion",
                    animate:false,
                    items:[
                       {
                          id:"accordion_1",
                          title:"accordion1"
                        },
                        {
                          id:"accordion_2",
                          title:"accordion2"
                        },
                        {
                          id:"accordion_3",
                          title:"accordion3"
                        }
                    ]
                   }],
                listeners:
                  {
                    "afterrender":function()
                      {
                        var activeItem = Ext.getCmp("accordion_2");  //the last expanded item
                        if (activeItem)
                          activeItem.expand();
                      }
                  }
              },
              {
                id:"centerPanel",
                region: "center",     // center region is required, no width/height specified
                margins: "0 5 0 0",
                layout:"border",
                autoScroll:false,
                items:[]
              }]
          });
    
    
      });

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    Instead of doing an expand in the afterrender event, why not just set collapsed : false on the item you want expanded?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Ext JS Premium Member
    Join Date
    Feb 2010
    Location
    Vancouver, BC
    Posts
    224
    Vote Rating
    1
      0  

    Default

    I have hardcoded accordion_2 to show you the bug, but value is actually from cookie
    activeItem = Ext.getCmp(Ext.util.Cookies.get("accordioncookie"));

    I don't know this is correct way or not.. but I changed it to below..
    and still doesn't work.

    activeItem.set("collapsed",false);
    activeItem.setConfig("collapsed",false);

Posting Permissions

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