View Full Version : hide the ContentPanel tab
d0uble_hel1x
20 May 2007, 6:57 AM
hi all,
i'm trying to develop an application with multiple modules with each having its own layout. is there a way to hide the tabs and activate the ContentPanel through a windows like "start" button? thanks.
jsakalos
20 May 2007, 9:01 AM
Yes, there is method hide of Ext.TabPanelItem and activate method of ContentPanel. Look in doc they are well documented there.
d0uble_hel1x
20 May 2007, 8:06 PM
i'm not using TabPanelItem and there isn't any hide/show method for ContentPanel. looks like i might have to implement i with TabPanelItem instead.
Richard
20 May 2007, 10:08 PM
layout.getRegion('center').getTabs().getTab(0).hide();
hides the tab contents of a contentPanel
but how do you hide the actual tab.
jsakalos
21 May 2007, 1:58 AM
i'm not using TabPanelItem and there isn't any hide/show method for ContentPanel. looks like i might have to implement i with TabPanelItem instead.
If you're using layout the content panels are automatically converted to tabs.
brendanheyu
22 May 2007, 1:02 AM
@ jsakalos (http://extjs.com/forum/member.php?u=2178)
I suppose the question would be (and I don't mean to sound rude) - why couldn't the documentation show that it is converted and those methods apply? I've been searching for an hour or so on this topic - and it seems it's very simple!
Thanks!
jsakalos
22 May 2007, 2:38 AM
@ jsakalos (http://extjs.com/forum/member.php?u=2178)
I suppose the question would be (and I don't mean to sound rude) - why couldn't the documentation show that it is converted and those methods apply? I've been searching for an hour or so on this topic - and it seems it's very simple!
Thanks!
Yes, documentation could state that. I also understand the feelings of a developer who is trying to get something running for long time and, believe me, it happens quite often also to me.
However, Jack and the developers team create "miracles" in very short time saving time of us, users. I'm prone to forgive them some missing or incorrect spots in documentation and I like to see them coding. The members of this forum are also great help as they share their knowledge which creates secondary, experience documentation.
I believe that Ext including all people around it is much much much more good than bad.
brendanheyu
22 May 2007, 9:26 PM
It seems you can make a ContentPanel active after it is built.
In one of the layout demos one if the intial tabs is active. It seems this is the code here:
layout.beginUpdate();
layout.add('north', new Ext.ContentPanel('north', 'North'));
layout.add('south', new Ext.ContentPanel('south', {title: 'South', closable: true}));
layout.add('west', new Ext.ContentPanel('west', {title: 'West'}));
layout.add('east', new Ext.ContentPanel(Ext.id(), {autoCreate:true, title: 'Dynamic Tab', closable: true}));
layout.add('east', new Ext.ContentPanel('autoTabs', {title: 'Auto Tabs', closable: true}));
layout.add('center', new Ext.ContentPanel('center1', {title: 'Close Me', closable: true}));
layout.add('center', new Ext.ContentPanel('center2', {title: 'Center Panel', closable: false}));
layout.getRegion('center').showPanel('center1');
layout.getRegion('west').hide();
layout.endUpdate();It's the showPanel property that does it. Bu I'll be b*uggered if I can get it to work in my code.
My code is thus:
innerLayout.add('south', new Ext.ContentPanel('docNavigation', {title: 'Document navigation', autoScroll: true}));
innerLayout.add('south', new Ext.ContentPanel('doc_notes', {title: 'Notes', autoScroll: true}));
innerLayout.add('south', new Ext.ContentPanel('doc_properties', {title: 'Properties', autoScroll: true}));
innerLayout.add('south', new Ext.ContentPanel('doc_destinations', {title: 'Destinations', autoScroll: true}));
innerLayout.add('center', new Ext.ContentPanel('inner1', {title: 'Doc 1', fitToFrame: true, autoScroll: true, resizeEl: 'center-iframe1'}));
innerLayout.add('center', new Ext.ContentPanel('inner2', {title: 'Doc 2', fitToFrame: true, autoScroll: true, resizeEl: 'center-iframe2'}));
layout.add('center', new Ext.NestedLayoutPanel(innerLayout));
layout.getRegion('south').showPanel('docNavigation');
layout.endUpdate();The error I get is "layout.getRegion("south") has no properties".
I'm the first to admit I'm not a great coder - so hey, keep the flames and forehead smacking to yourselves :)
Brendan
brendanheyu
22 May 2007, 9:33 PM
You know - I just had to see my problem posted. Air my dirty laundry so to speak.
Then.... #ZAP!#
Bingo - the problem is staring at me in my face.
Can you spell innerLayout?
Ignore my problem - but this is the solution to activating a contentPanel.
//create it
var givenID = Ext.id();
var centerRegion = this._layout.getRegion('center');
centerRegion.add(
new Ext.ContentPanel(givenID, {
autoCreate:true,
closable: true,
title: '点击图片或链接弹出内置对话框'
})
);
var tab = centerRegion.getTabs().getTab(givenID);
tab.on('close',function(){
alert('closing')
})
centerRegion.remove(givenID);
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.