change property binded to component in even listener fail

asked 2018-10-22 17:21:20 +0800

superium gravatar image superium
29 5
    @NotifyChange({ "currentPost", "winvisible" })
    public void doAdopt() {
        Messagebox.show("sure?", "make sure",
                new Messagebox.Button[] { Messagebox.Button.OK, Messagebox.Button.CANCEL }, Messagebox.QUESTION,
                new EventListener<ClickEvent>() {

                    public void onEvent(ClickEvent event) throws Exception {
                        if (Messagebox.Button.OK.equals(event.getButton())) {
                            //do somthing here ,if success:
                            setWinvisible(false);     //failed to hide my window.and got null exception atfer this executed, and click component in the window.

                            } else {
                                //do something


        if (.........) 
            setWinvisible(false);      //success, and this executed before user response the messagebox.

hello, I'm using MVVM, and failed to hide my window in the even listener. any suggestion ?

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-10-23 10:18:03 +0800

cor3000 gravatar image cor3000
4952 2 7
ZK Team

inside the event listener (which is not an MVVM command handler) method you have to trigger the notify change programmatically.

if (Messagebox.Button.OK.equals(event.getButton())) {
    //do something here, if success:
    BindUtils.postNotifyChange(null, null, YourViewModelClass.this, "winvisible");
} else {
    //do something
link publish delete flag offensive edit
Your answer
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




Asked: 2018-10-22 17:21:20 +0800

Seen: 5 times

Last updated: Oct 23 '18

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