View Full Version : define rowexpander within grid conf

9 Mar 2011, 3:55 AM
Is it possible to define rowexpander within gridpanel?
It is grid specific, so I would like it to be part of gridpanel config.

11 Mar 2011, 7:49 PM
Yes this is possible.
See the first grid in this example (http://dev.sencha.com/deploy/dev/examples/grid/grid-plugins.html).

Then, in your grid, initialize a new property 'expander' and use this for your columnModel.

var grid1 = new xg.GridPanel({
store : new Ext.data.Store({...}),
expander: new Ext.ux.grid.RowExpander({
tpl : new Ext.Template(
'<p><b>Company:</b> {company}</p><br>',
'<p><b>Summary:</b> {desc}</p>'
cm : new xg.ColumnModel({
defaults : {...},
columns : [
{id:'company',header: "Company", width: 40, dataIndex: 'company'},
// etc
viewConfig : {...}
// etc.

14 Mar 2011, 12:17 AM
hi walldorff,

Did you actualy try this successfully?
I have tried this my self, but for some reason it doesn't work.
I get some undefined ID error.

I guess it is due to the plugins: [...] conf, where it expects object to already exist.

edit: it is actualy due to column model missing ID for expander as it doesn't exit yet.

14 Mar 2011, 12:34 AM
Ok, did find a working solution.

Had to throw code around a bit, and plugins must be defined before column model.


plugins: [
this.expander = new Ext.ux.grid.RowExpander({ ... })

cm: new Ext.grid.ColumnModel({ ... })