-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Tab contains a window. When close tab how to trigger event close window. ( I want confirm when close window)
Hi,
here is a sample
<tabbox xmlns:w="client"> <tabs> <tab id="mainTab" label="Main Tab" closable="true" w:onClose='event.stop({au:true});zAu.send(new zk.Event(zk.Widget.$("$mainWin"), "onCloseConfirm", null));'> </tab> </tabs> <tabpanels> <tabpanel> <window id="mainWin" title="Main Window" closable="true"> <attribute name="onCloseConfirm"> org.zkoss.zul.Messagebox.show("Are you sure you want to close this main window?", "Question", org.zkoss.zul.Messagebox.OK | org.zkoss.zul.Messagebox.CANCEL, org.zkoss.zul.Messagebox.QUESTION, new org.zkoss.zk.ui.event.EventListener(){ public void onEvent(Event e){ if(org.zkoss.zul.Messagebox.ON_OK.equals(e.getName())){ //close confirmed mainTab.close(); }else if(org.zkoss.zul.Messagebox.ON_CANCEL.equals(e.getName())){ //close cancelled } } }); </attribute> </window> </tabpanel> </tabpanels> </tabbox>
Asked: 2012-11-22 15:12:17 +0800
Seen: 109 times
Last updated: Nov 28 '12