0

Confirm close window in tab

asked 2012-11-22 15:12:17 +0800

longdv1208 gravatar image longdv1208
98 4

Tab contains a window. When close tab how to trigger event close window. ( I want confirm when close window)

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2012-11-28 03:58:38 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

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>

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: 2012-11-22 15:12:17 +0800

Seen: 109 times

Last updated: Nov 28 '12

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