Wednesday, 15 May 2013

arguments - use parameters in conditional command in zk framework -



arguments - use parameters in conditional command in zk framework -

i'm triying utilize conditional @command argument passed executions.createcomponents, java code:

map info = new hashmap(); data.put("isfromhere", true); modal = (window) executions.createcomponents("root/to/window", null, data); modal.domodal();

and in zul page i'm trying this:

<button label="save" onclick="@command(arg.isfromhere ? 'save' : 'not')" />

but every time arg.isfromhere returning false, argument not passed. if this:

<button if="${arg.isfromhere}" label="save" onclick="@command('save'" />

that work fine! means arguments getting zul page, not working on conditional commands, there way create work?

it has lifecycle of binder. @command , ${arg.xxx} on different lifecycle.

read documentation , see solution in it.

solution :

vm : private boolean fromhere; @init public void init(@executionargparam("isfromhere") boolean fromhere){ this.fromhere = fromhere; } public boolean isfromhere() { homecoming fromhere; } zul : <button label="save" onclick="@command(vm.fromhere ? 'save' : 'not')" />

command arguments conditional zk zul

No comments:

Post a Comment