View Full Version : Expanding all rows in RowExpander by default

4 Mar 2013, 3:06 PM

How do I expand all of the rows in a RowExpander by default in Ext JS?

Say you have the following code:

var expander = new Ext.ux.grid.RowExpander({
tpl : new Ext.Template(
'<p><b>Company:</b> {company}</p><br>',
'<p><b>Summary:</b> {desc}</p>'

var grid1 = new xg.GridPanel({
store: new Ext.data.Store({
reader: reader,
data: xg.dummyData
cm: new xg.ColumnModel({
defaults: {
width: 20,
sortable: true
columns: [
{id:'company',header: "Company", width: 40, dataIndex: 'company'},
{header: "Price", renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
{header: "Change", dataIndex: 'change'},
{header: "% Change", dataIndex: 'pctChange'},
{header: "Last Updated", renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
viewConfig: {
width: 600,
height: 300,
plugins: expander,
collapsible: true,
animCollapse: false,
title: 'Expander Rows, Collapse and Force Fit',
iconCls: 'icon-grid',
renderTo: document.body


4 Mar 2013, 4:29 PM
There aren't any public convenience methods to expand/collapse rowexpander rowbodies. Even the toggleRow() method is private. Expanding all rows will take some searching into the source code for RowExpander and doing some surgery/addition on your own to that class.