-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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.
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;
}
Asked: 2014-03-28 10:04:28 +0800
Seen: 24 times
Last updated: Mar 28 '14