# notifyChange of setter

chillworld
5322 4 9
https://github.com/chillw...

Hi all,

I want to start a discussion for this fiddle

If you run the fiddle => enter text in first textbox you see the label next to the textbox is sitting itself correct.
This is normal cause I trigger the setter and he notify's the zul because he is changed.

The second textbox is almost the same, I just added an extra notifychange on the setter. Mine expectation : the 2 labels should setting itself correct.
Result : only the label above is setting itself correct.

The third textbox is doing the result what I expected for the second one. The change is that I notify an extra field (itself).

It's strange behaviour in mine oppinion cause why do we need to declare that the field we are setting is getting updated or is it just a good functionality because we don't always have to notify the field we are setting?

Greetz chill.

delete retag edit

## 2 Replies

cyiannoulis
1191 10

I agree with you that sometimes the binding mechanism is not very elegant but it is flexible. On the other hand, why did you use the @NotifyChange instead of the @DependsOn? Something like this looks more sensible to me:

public class TestVM {
private String remark;
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
@DependsOn("remark")
public String getRemark2() {
return remark;
}
public void setRemark2(String remark) {
this.remark = remark;
}
@DependsOn("remark")
public String getRemark3() {
return remark;
}
public void setRemark3(String remark) {
this.remark = remark;
}
}


Costas

chillworld
5322 4 9
https://github.com/chillw...

Hey Costas,

I'm not (for the moment) a real fan of the DependsOn and find mixing the 2 is asking for faults to happen.
Your comment is indeed correct that it will work correctly when you use the DependsOn, maybe I need to revise mine oppinion about the DependsOn.

Greetz chill.

[hide preview]