0

radiogroup onCheck/onChange not calling to the binded command

asked 2014-03-28 10:04:28 +0800

hlfernandez gravatar image hlfernandez
11 1

Hi everybody,

I have looked for the solution of my problem but I cannot find it, so I'll ask it to you.

I have a radiogroup binded whose model and selectedItem are properly binded to the ViewModel properties. Until here everything works fine. But now, I need to detect when the selectedItem changes, so I am binding the onCheck/onChange to a command, but this command is never fired. Here are the pieces of code: .zul

<radiogroup model="@load(vm.experimentTypeValues)"
                                selectedItem="@bind(vm.experimentType)"
                                onCheck="@command(changeExperimentType)" />

.java

@NotifyChange("executionLevel")
@Command("changeExperimentType")
public void changeExperimentType(){
    System.out.println("Setting executionLevel to null");
    this.executionLevel = null;
}

Thank you very much for your help.

Regards,

Hugo.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-03-28 10:14:14 +0800

chillworld gravatar image chillworld flag of Belgium
5357 4 9
https://github.com/chillw...

very simpel solution :

<radiogroup model="@load(vm.experimentTypeValues)" selectedItem="@save(vm.experimentType, before='changeExperimentType') @load(vm.experimentType)" onClick="@command(changeExperimentType)" />

But actually the best thing you can do is just this and you will not have to use the command:

 @NotifyChange("executionLevel","experimentType")
 public void setExperimentType(... type) { // add the class what you set.
     this.experimentType = type;
     //  now you know it's changed, otherwise the setter wouldn't be called.
     System.out.println("Setting executionLevel to null"); 
     this.executionLevel = null;
 }
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

Follow
1 follower

RSS

Stats

Asked: 2014-03-28 10:04:28 +0800

Seen: 24 times

Last updated: Mar 28 '14

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