0

use the onClose event to set a boolean property to false

asked 2012-06-27 13:11:43 +0800

boskonovic gravatar image boskonovic
46 1

updated 2012-06-27 13:18:39 +0800

hello every one i'm trying to show/hide a popup window using a view model, but it's not working.
in my view model i have a property called visible and a method where i set visible to true to show the popup window:

//command to show popup
@Command("details")
@NotifyChange("visibleDetails")
public void showDetails(){

this.visibleDetails=true;
}



//command to  hide popup
@Command
@NotifyChange("visibleDetails")
public void hide(){

this.visibleDetails=false;
}

this is the command in the zul:

<image src="/images/detail14.png" onClick="@command('details')" ></image>

and here's my popup window in the same zul:

<window id="w_details" mode="popup" closable="true" position="center" width="60%"  visible="@load(vm.visibleDetails)" onClose="@command('hide')"></window >

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2012-06-27 14:04:59 +0800

Jales gravatar image Jales
161 1

Please give the "same zul" that you mean, so we can examine it more thorough.

link publish delete flag offensive edit

answered 2012-06-27 14:39:58 +0800

boskonovic gravatar image boskonovic
46 1

updated 2012-06-27 14:41:15 +0800

It seems impossible to do it according to this but anyway i'm posting the "same zul".

<window apply="org.zkoss.bind.BindComposer"
		viewModel="@id('vm') @init('test.testVM')">
		
							<image src="/images/detail14.png"
								onClick="onClick="@command('details')" ></image>





				<window
					xmlns:a="http://www.zkoss.org/2005/zk/annotation"
					 mode="popup" closable="true" position="center" width="60%"  visible="@load(vm.visibleDetails)" onClose="@command('hide')">





					
				</window>

			
	</window>



link publish delete flag offensive edit

answered 2012-09-11 05:43:16 +0800

paowang gravatar image paowang
140 6

I can do it. Check this (using zk 6.0.2):

zul

<window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('TestVM')">
	<image src="/demo.jpg" onClick="@command('details')" />
	<window mode="popup" position="center" width="200px" visible="@load(vm.visibleDetails)"
		border="normal" title="Title">
		<label value="Hello!" />
		<button label="Close" onClick="@command('hide')" />
	</window>
</window>

TestVM.java

import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.NotifyChange;

public class TestVM {
	private boolean visibleDetails;

	public boolean getVisibleDetails() {
		return visibleDetails;
	}

	@Command("details")
	@NotifyChange("visibleDetails")
	public void showDetails() {
		this.visibleDetails = true;
	}

	@Command
	@NotifyChange("visibleDetails")
	public void hide() {
		this.visibleDetails = false;
	}
}

link publish delete flag offensive edit

answered 2012-09-14 13:54:30 +0800

boskonovic gravatar image boskonovic
46 1

@paowang: thank you.I know it works that way . But i was trying to use the default close button. As you can see i set the closable attribute to true.
Thank you anyway.

link publish delete flag offensive edit

answered 2012-09-14 18:02:45 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Hi you can see this also..

	<button label="Cancel"
				onClick="modelWindowId.detach()" />

Where modelWindowId. is the id of your model window..

In Your case it will be something like this.

<button label="Cancel"
				onClick="w_detailsd.detach()" />

Thanks

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-06-27 13:11:43 +0800

Seen: 217 times

Last updated: Sep 14 '12

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