1. #1
    Sencha User deanoj's Avatar
    Join Date
    Mar 2008
    Location
    Yorkshire, England.
    Posts
    183
    Vote Rating
    0
    deanoj is on a distinguished road

      0  

    Default Row Expander - expand 1st row by default

    Row Expander - expand 1st row by default


    Hi guys & girls

    I have a question I hope someone can help with.

    I have a grid working fine with paging, the row expander plugin and an expand all button. The last issue I can't fingure out is how to make the first row expanded by default.

    After searching the forums I found this post: http://extjs.com/forum/showthread.php?t=24485, but couldn't get it work correctly. I've spent a morning on this and still can't crack it.

    Can anyone offer some advice?

    Thanks in advance - Deano

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


    Try:

    Code:
    myExpander.expandRow(0);

  3. #3
    Sencha User deanoj's Avatar
    Join Date
    Mar 2008
    Location
    Yorkshire, England.
    Posts
    183
    Vote Rating
    0
    deanoj is on a distinguished road

      0  

    Default


    Hi Evant

    Thanks for replying.

    I tried your suggestion with no luck...it throws an error:

    PHP Code:
    row has no properties
        
    var record this.grid.store.getAt(row.rowIndex); 
    It seems to me that the row object is not been returned correctly in the RowExpander.js

    PHP Code:
    if(typeof row == 'number'){
        
    row this.grid.view.getRow(row);

    'row' is still undefined after this statement.

    By the way I am calling
    PHP Code:
    myExpander.expandRow(0); 
    right at the end of my script...I presume this is correct?

    Deano

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


    You should probably do it after the grid is rendered:

    Code:
    myGrid.on('render', function()
    {
       myExpander.expandRow(0);
    }
    );
    If that fails, try it on store load.

  5. #5
    Sencha User deanoj's Avatar
    Join Date
    Mar 2008
    Location
    Yorkshire, England.
    Posts
    183
    Vote Rating
    0
    deanoj is on a distinguished road

      0  

    Default


    Evant

    The load listener on my store cracked it thank you.

    Deano

  6. #6
    Ext JS Premium Member
    Join Date
    Apr 2009
    Location
    Brasil
    Posts
    20
    Vote Rating
    0
    benyhapper is on a distinguished road

      0  

    Question


    How could you run the option to leave the first row grid expanded? You can post the complete example?

    Thanks

  7. #7
    Ext User
    Join Date
    Feb 2009
    Posts
    1
    Vote Rating
    0
    lovzan is on a distinguished road

      0  

    Default expand/collapse All Rows

    expand/collapse All Rows


    Code:
    function expandAllRows()
    {
        nRows=store.getCount();
        for(i=0;i< nRows;i++)
            myExpander.expandRow(grid.view.getRow(i));
    }
    
    function collapseAllRows()
    {
        nRows=store.getCount();
        for(i=0;i<nRows;i++)
            myExpander.collapseRow(grid.view.getRow(i));
    }