PDA

View Full Version : Adding ContentPanels to regions



Animal
7 Nov 2006, 8:47 AM
As you add, it creates tabs if you have autoTabs:true on the region config.

How do you specify that the tab created by the add(myContentPanel) call be closable?

luke83
7 Nov 2006, 8:51 AM
this works:


closeOnTab: true

it add the "x" image on the tabs to close the panel added

Animal
7 Nov 2006, 9:32 AM
I have



this.listPanel = new YAHOO.ext.GridPanel(this.grid,
{
title:"The List",
fitToFrame:true,
closeOnTab: true
});
this.layout.add("north", this.listPanel);


And there's no "x", my list tab is not closable.

luke83
7 Nov 2006, 9:47 AM
it works in borderLoyout, i don't know if the interface is the same, sorry...

jack.slocum
7 Nov 2006, 3:21 PM
A panel has the closable attribute:

closable: true

The closeOnTab attribute is for the region:

north: {
closeOnTab: true
....
}

Animal
8 Nov 2006, 12:26 AM
Hmmm. I don't want all the tabs to be closable, just selected ones.

I have 1 or more filter tabs in which are entered selection criteria. These should not be closable.

When "Search" is clicked, I create a Grid and a GridPanel and add that, which becomes the last tab. That should be closable - just for user convenience.

Repeating a "Search" operation removes the grid panel (tab), and creates a new one, but I'd like the user to have the choice.

jack.slocum
8 Nov 2006, 4:59 AM
Yep, that's why "closable" is on the panel, not the region. closeOnTab just tells where to put the close icon for that region.

Animal
8 Nov 2006, 5:29 AM
Ahah! You need both!

closeOnTab in the Region, and closable in the ContentPanel!