1. #1
    Ext User
    Join Date
    Jan 2009
    Posts
    14
    Vote Rating
    0
    Brat.Pidd is on a distinguished road

      0  

    Default Grid + Row Expander + One Row at a time

    Grid + Row Expander + One Row at a time


    Hi, I currently creating Grid with row expander, but having difficulty when I want to implement one row at a time....

    So, when I click row-1, it expands... then when I click row-2, row-1 will collapses and row-2 expands.

    Can anyone provide help or links? (sorry if this thread has been posted before)

    Thanks for any helps...

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    97
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    So you want to collapse all rows on expand of one row?

    Try something like:
    Code:
    expander.on('beforeexpand', function(expander, record, body, rowIndex){
    	for(var id in expander.state){
    		if(expander.state.hasOwnProperty(id) && expander.state[id]){
    			expander.collapseRow(expander.grid.getStore().indexOfId(id));
    		}
    	}
    });

  3. #3
    Ext User
    Join Date
    May 2009
    Posts
    7
    Vote Rating
    0
    devenciel is on a distinguished road

      0  

    Default


    hi! condor...
    i have a same problem with mr. brat pidd

    i have try your code in my program, but it always error..
    this is the error message.

    Index or size is negative or greater than the allowed amount" code: "1
    http://localhost/zikula/modules/Exam...t-all-debug.js
    Line 32252



    i try to build nested grid within expander and tab panel.
    when i expand the row 0, then i expand the other row, data in the grid always refresh and same each other.
    if you have solution for this error, please share to me....

    thanks u very much....

  4. #4
    Ext User
    Join Date
    Jan 2009
    Posts
    14
    Vote Rating
    0
    Brat.Pidd is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    So you want to collapse all rows on expand of one row?

    Try something like:
    Code:
    expander.on('beforeexpand', function(expander, record, body, rowIndex){
        for(var id in expander.state){
            if(expander.state.hasOwnProperty(id) && expander.state[id]){
                expander.collapseRow(expander.grid.getStore().indexOfId(id));
            }
        }
    });
    Thanks Condor.

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    97
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Quote Originally Posted by devenciel View Post
    hi! condor...
    i have a same problem with mr. brat pidd

    i have try your code in my program, but it always error..
    this is the error message.

    Index or size is negative or greater than the allowed amount" code: "1
    http://localhost/zikula/modules/Exam...t-all-debug.js
    Line 32252



    i try to build nested grid within expander and tab panel.
    when i expand the row 0, then i expand the other row, data in the grid always refresh and same each other.
    if you have solution for this error, please share to me....

    thanks u very much....
    Well, my code could fail if your store is also filtered or paged.

    Try if this helps:
    Code:
    expander.on('beforeexpand', function(expander, record, body, rowIndex){
    	for(var id in expander.state){
    		if(expander.state.hasOwnProperty(id) && expander.state[id]){
    			var index = expander.grid.getStore().indexOfId(id);
    			if(index >= 0){
    				expander.collapseRow(expander.grid.getStore().indexOfId(id));
    			}
    		}
    	}
    });

  6. #6
    Ext User
    Join Date
    May 2009
    Posts
    7
    Vote Rating
    0
    devenciel is on a distinguished road

      0  

    Default


    thanks condor,,
    i have a trouble when i build nested grid within rowexpander and tabpanel
    follow this link http://extjs.com/forum/showthread.ph...528#post328528

    thanks...

Thread Participants: 2