Sandy
Sandy

Reputation: 2449

extjs rowexpander inside another rowexpander is not expanding

I have a rowexpander and in each rowexpander, there is another row expander. But inside rowexpanders are not expanding on calling expandAllRows()

 Ext.each(partyPanels, function (partyPanel, index) {
            partyPanel.expand(true); // Expand the parties             
            partyPanel.grid.expander.expandAllRows(); // Expand all the rows of the grid
            partyPanel.grid.expander.grid.expander.expandAllRows();
        });

Whats solution?

Upvotes: 1

Views: 777

Answers (1)

JustBeingHelpful
JustBeingHelpful

Reputation: 18980

If each nested grid (with rowexpander) is dependent on its parent grid (with a rowexpander), you will need to nest your expandbody calls inside of one another after within the grid afterrender event listener. This is what I had to do. Essentially you will need to pass parameters to each nested grid, so those parameters become configs. Then inside the grid definition, pull out those variables using me.variableForRowExpander, and then expand the nested grid.

Depending on how you are building the grids, you can at least use this concept and go from there.

Ext.define('App.view.MyGrid', {
    extend: 'Ext.grid.Panel',

// grid configs

listeners: {

    afterrender: function(grid) {

        var me = this;

        this.getView().on('expandbody',
            function(rowNode, record, expandbody) {

                // place logic to build another nested grid dynamically.
                // ideally rowexpander should be placed inside the grid definition, not when instantiating the grid

                // me.gridCustomVariable = variable necessary to build nested grid and nested rowexpander configuration
        }
    }
}

Upvotes: 1

Related Questions