0

Binding load-when

asked 2010-04-21 05:13:29 +0800

Arsen gravatar image Arsen
381 2

Binder loads value to UI before event is triggered, what should I do, if I want binder to trigger after event?
Here is simple example. Button is not disabled after first click, because binder has triggered before onClick event while disabled == false. The second click disables button :-) but I need it on the first click.
ZK 3.6.4

<zk xmlns="http://www.zkoss.org/2005/zul">
<window>
    <zscript>
        boolean disable = false;
    </zscript>
    <button id="button" label="clickMe" disabled="@{disable, load-when='button.onClick'}">
        <attribute name="onClick">
            disable=true;
        </attribute>
    </button>
</window>
</zk>

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2010-04-21 08:13:45 +0800

robertpic71 gravatar image robertpic71
1275 1

Use load-after instead of load-when. This way the binder does his work after the event.

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="./mywin"?>
<window id="mywin">
    <zscript>
        boolean disable = false;
    </zscript>
    <button id="button" label="clickMe" disabled="@{disable, load-after='button.onClick'}">
        <attribute name="onClick">
            disable=true;
        </attribute>
    </button>
</window>

/Robert

link publish delete flag offensive edit

answered 2010-04-21 10:42:27 +0800

Arsen gravatar image Arsen
381 2

Thanks, Robert :-)

link publish delete flag offensive edit

answered 2010-12-02 23:21:20 +0800

rohitwadke gravatar image rohitwadke
339 1 5

How to disable screen on button click???
i want to gray out the screen on button click, my progressbox appears on some process works can we disable screen on processbox processing??

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: 2010-04-21 05:13:29 +0800

Seen: 1,074 times

Last updated: Dec 02 '10

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