Ok, I've progressed a bit. For anyone who may be trying to figure the same thing out:
My new changePanel() function on the grid:
,changePanel: function(grid, id) {
Ext.getCmp('home-panel').replaceGrid(grid, id);
}
I call it with:
,listeners : {
'rowclick': function(grid, index, rec){
if (grid.getSelectionModel().hasSelection()) {
var row = grid.getSelectionModel().getSelections()[0];
var id = row.get('id');
}
this.changePanel(grid, id);
}
}
I extended the home panel which the grid is a child of and added a replaceGrid() function.
This is where I'm now getting a bit stuck.
Ext.extend(ExampleProject.panel.Home,MODx.Panel,{
replaceGrid: function(grid, id) {
var tabs = Ext.getCmp('main-tabs');
var tab = tabs.getActiveTab();
tab.remove('exampleproject-grid-competitions');
var artworkGrid = new Ext.getCmp('exampleproject-grid-artworks');
tab.add(artworkGrid);
tab.doLayout();
}
});
The original grid is removed from the panel no problem but the new one is not being displayed.
For simplicity, the "exampleproject-grid-artworks" grid is exactly the same as the original grid besides the naming and the database table it points to.
I have a feeling I'm not instantiating the new grid correctly. Any ideas?