PDA

View Full Version : Adding multiple Grids to a TabPanel



hebee
23 Feb 2009, 10:36 AM
I'm working on a project where i have a grid in that is used to select a name. Upon double-clicking on a name, a new tab which contains the data in a grid for the selected name has to be added to a tabpanel. The title of the tab should be the selected person's name. I manage to create one tab, but upon clicking a different name, the data in the just generated tab disapears and the tab's title is not updated. What i want is that a new tab opens with the just selected person's data, or if that's not possible, that the old tab updates with a another person's data.

My code so far looks something like this:



...
listeners: {
rowdblclick: function(namegrid, rowIndex, e){
var record = namegrid.getStore().getAt(rowIndex).get('id');
var name = namegrid.getStore().getAt(rowIndex).get('name');
store = new Ext.data.Store({
id: 'store',
proxy: new Ext.data.HttpProxy({...}),
baseParams:{...},
reader: new Ext.data.JsonReader({...});
pb = new Ext.PagingToolbar( {...});
cm = new Ext.grid.ColumnModel(...);
grid = new Ext.grid.EditorGridPanel({...});
store.load({... });
center.add(grid);
center.setActiveTab(grid);
}
}
...

Animal
23 Feb 2009, 11:11 AM
All the Stores get the same ID 'store' do they?

hebee
23 Feb 2009, 11:25 AM
Uh, yeah. Changed the id to a variable and it works. Now I feel really stupid :).

Thanks :)