1

MVVM Notifychange for bean property not working ?

asked 2013-11-01 11:04:43 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2611 3 8
http://emrpms.blogspot.in...

The below is working

@Command
@NotifyChange("selectedRecord")
public void onSelectLocationLookup(
        @BindingParam("selectedRecord") Location location) {
    if (location!=null)
        this.selectedRecord.setLocationCode(location.getCode());
}

But if want to notify only particular as follow, then not firing

    @Command
@NotifyChange("selectedRecord.locationCode")
public void onSelectLocationLookup(
        @BindingParam("selectedRecord") Location location) {
    if (location!=null)
        this.selectedRecord.setLocationCode(location.getCode());
}

Even i tried with selectedRecord.LocationCode

delete flag offensive retag edit

3 Answers

Sort by ยป oldest newest most voted
1

answered 2013-11-04 06:33:26 +0800

cor3000 gravatar image cor3000
4293 1 7
ZK Team

Hi Senthil,

in your case you can invoke BindUtils.notifyChange programmatically like this:

@Command
public void onSelectLocationLookup(
        @BindingParam("selectedRecord") Location location) {
    if (location!=null) {
        this.selectedRecord.setLocationCode(location.getCode());
        BindUtils.postNotifyChange(null,  null, this.selectedRecord, "locationCode");
    }
}

regards,

Robert

link publish delete flag offensive edit
0

answered 2013-11-04 07:43:31 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2611 3 8
http://emrpms.blogspot.in...

Oh Thank you robert. I just wonder, why ZK is not allowed to do the same using notifychange annotation

link publish delete flag offensive edit

Comments

in fact it is doing the same as BindUtils.notifyChange() publishing a PropertyChangeEvent (which supports Object base and String property), @NotifyChange uses the view model as the object base. So no restriction, just works as implemented.

cor3000 ( 2013-11-04 08:43:46 +0800 )edit
0

answered 2013-11-04 07:46:01 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2611 3 8
http://emrpms.blogspot.in...

Sorry benbai. When i click the arrow button, i thought the popup will show all the list items

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: 2013-11-01 11:04:43 +0800

Seen: 56 times

Last updated: Nov 04 '13

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