PDA

View Full Version : is there a bug in expander plugin and tabpanel?



gustavoh84
21 Aug 2009, 11:49 AM
Hi!
I'm using a expander plugin together gridpanel, and I have a problem about this. When I active the plugin, the tabpanel can not closed. If I click in the close button, only the grid is hidden, but the tab is not destructed.

The firebug accuses a error at line 143 of RowExpander.js:
mainBody is undefined

Why?



var expander = new Ext.ux.grid.RowExpander({
tpl : new Ext.Template(
'<p>&nbsp;<b>Descrição:</b> {desc}</p>'
)
});
var grid = new Ext.grid.GridPanel({
region: 'center',
frame: true,
title: 'Operações em aberto',
minHeight: 200,
height: 300,
plugins: expander,
collapsible: true,
columnLines: true,
autoExpandColumn: 'name',
store: new Ext.data.Store({
autoLoad: true,
reader: new Ext.data.JsonReader({
totalProperty: 'total',
root: 'rows',
id: 'id',
fields: [
'id', 'name', 'owner_id', 'datetime_add', 'datetime_change', 'reject'
]
}),
proxy: new Ext.data.HttpProxy({
url: params['url_grid'],
method: 'POST',
})
}),
colModel: new Ext.grid.ColumnModel({
defaults: {
width: 120,
sortable: true
},
columns: [
expander,
{ header: 'id', dataIndex: 'id', hidden: true },
{ header: 'Nome', dataIndex: 'name', id: 'name' },
{ header: 'Dono', dataIndex: 'owner_id', sortable: true },
{ header: 'Cadastro', dataIndex: 'datetime_add' },
{ header: 'Atualizado', dataIndex: 'datetime_change' },
{ header: 'Rejeitado', dataIndex: 'reject' }
],
}),
listeners: {
rowdblclick: {
fn: function(g, i, e) {
var p, id = g.getSelectionModel().getSelected().get('id')
p = {'work_id': id, 'step_id': step_id}
workdataByWork(p);
}
}
},
sm: new Ext.grid.RowSelectionModel({
singleSelect: true,
}),
});


tb_main.add({
id: 'panel_dynform',
title: 'test',
closable: true,
items: [ grid ]
}).show();

23 Aug 2009, 2:54 PM
my first question is why are you not adding the grid directly instead of wrapping it a panel?

gustavoh84
23 Aug 2009, 4:57 PM
Because I creates a lot of grid, dynamically, according of the data clicked by user, so add in the tabpanel.
I solved the bug commenting the respective line [1] in the RowExpander.js.

[1] line 143: //mainBody.un('mousedown', this.onMouseDown, this);