0

How to close Tab in the innerpage ?

asked 2009-02-25 09:15:00 +0800

evpole gravatar image evpole
481 2

updated 2009-02-25 09:15:33 +0800

there's a iframe whose parent is a tabpanel,and a page called innerpage was setted as the src of the iframe.I want to close the tab and tabpanel in innerpage.How could i achieve this ?

in outerpage.zul :
-------------------------------------------------------------
<?page id="outerpage"?>
<tabbox panelSpacing="50px" id="tabbox" height="99%">
<tabs id="tabs">
<tab label="tab1" />
</tabs>
<tabpanels id="panels">
<tabpanel>
<include src="innerpage.zul" />
</tabpanel>

</tabpanels>
</tabbox>

---------------------------------------------------------------

and now ,I want to close the tab from innerpage.zul.

How could I write the behaver of the close_button in innerpage.zul ?
in addtion,This is a demo, in my real program,the tab and tabpanel was created dynamicly.

innerpage.zul:
----------------------------------------------------------
<toolbarbutton label="Close this Tab" id=" close_button" />

---------------------------------------------------------


another question :is it possible to close all tabs in outerpage like a browser called maxthon does ?

thanks for any advise !

delete flag offensive retag edit

5 Replies

Sort by » oldest newest

answered 2009-02-27 06:07:33 +0800

evpole gravatar image evpole
481 2

I've got a way:

first detach the tabpanel and then detach the tab:
tabpanel1.detach();
tab1.detach();

but i have to find which tab is linked to the current tabpanel.
could i use tabpanel1.getLinkedTab().detach()?
but this returns an Null Pointer Exception.
could anyone please help me ?thanks!

link publish delete flag offensive edit

answered 2009-03-11 01:16:42 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

Do you use on-demend-loading? If so, the panel might not be there. You have to check null before you call detach.

link publish delete flag offensive edit

answered 2009-03-11 07:14:22 +0800

evpole gravatar image evpole
481 2

Thanks for respose,henrichen!
i havn't use fulfill.
i created it by:
new Tab().setParent();
new Tabpael().setParent();

link publish delete flag offensive edit

answered 2009-03-12 00:38:48 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

The implementation is really count on index of the Tab and Tabpanel.
1. check the index of the Tab in Tabs.
2. find the Tabpanel in Tabpanels per the index.

Maybe you want to check the number of the Tab and Tabpanel. In other words, you have to get the tab panel before you detach Tab.

link publish delete flag offensive edit

answered 2009-03-12 02:41:17 +0800

evpole gravatar image evpole
481 2

Thanks very much,I've got it!

tabs.getTabbox().getSelectedPanel().detach();
tabs.getTabbox().getSelectedTab().detach();

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-02-25 09:15:00 +0800

Seen: 956 times

Last updated: Mar 12 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More