View Full Version : GridPanel SetID

25 May 2007, 9:01 AM
Is there anyway to set the ID of a GridPanel? I see in the docs that several of the controls have a setID() method. But it doesn't appear to be in GridPanel.

The problem I am having is,
I am creating tabs on the fly based upon menu items the user clicks. Each tab has a grid in it. So I create the grid, associate it to a GridPanel and it shows up in the center region of the layout. If the user clicks the same link a second time I want to activate the existing tab and not create a new one. If I use the following code to check for existance of a tab

if (innerLayout.getRegion("center").getTabs().getTab(myId))
//activate it
//create it

it doesn't find the tab with myId because GridPanel creates it's own id's.

The only other option I can think of is to create an array mapping myId's to GridPanel id's. But that is kind of clumsy.


25 May 2007, 11:16 AM
To solve this, my case this is with dialogs, I used this:

dialogs = { }
function newDialog(id) {
var dialogId = "F_Dialog_"+Id;
if (!dialogs[dialogId]) {
dialogs[dialogId] = new Ext.BasicDialog(NomeForm, {
autoTabs:false, autoCreate:true, width:370,
height:255, resizable: false, shadow:true,
dragable:true, proxyDrag:true, title:"My New Dialog"

To access I use: dialogs[Id].

If you use firebug, at comando line use: newDialog('cities'); dir(dialogs['cities']);

And you see all information about the dialog 'cities'.

25 May 2007, 10:23 PM
You create the Grid that the GridPanel is created from in a container don't you? Give that container an id. That will be the id of the GridPanel, and therefore of the Tab.