It will send the parameters to both commands but you doesn't need to fetch them
chillworld ( 2015-11-09 22:06:09 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I'm triying to use a conditional @command with an argument passed with Executions.createComponents, this is my java code:
Map data = new HashMap();
data.put("isFromHere", true);
modal = (Window) Executions.createComponents("root/to/window", null, data);
modal.doModal();
And in my zul page I'm trying to do this:
<button label="Save" onClick="@command(arg.isFromHere ? 'save' : 'not')" />
But every time arg.isFromHere
is returning false, like the argument is not passed. But if I do this:
<button if="${arg.isFromHere}" label="Save" onClick="@command('save'" />
That does work fine! What means the arguments are getting to the zul page, but not working on conditional commands, Is there a way to make it work?
It has all to do with the lifecycle of the binder.
@Command
and ${} are get on different times.
Read this documentation and see your solution in it.
Solution for you :
private boolean fromHere;
@Init
public void init(@ExecutionArgParam("isFromHere") boolean fromHere){
this.fromHere = fromHere;
}
public boolean isFromHere() {
return fromHere;
}
<button label="Save" onClick="@command(vm.fromHere ? 'save' : 'not')" />
Greetz chill.
It will send the parameters to both commands but you doesn't need to fetch them
chillworld ( 2015-11-09 22:06:09 +0800 )editAsked: 2014-06-20 15:53:33 +0800
Seen: 60 times
Last updated: Jun 20 '14