Revision history [back]

click to hide/show revision 1
initial version

answered 2017-09-28 10:48:34 +0800

cor3000 gravatar image cor3000

ZK Team

the @NotifyChange annotation only works in combination with @Command.

In your case you should try something like this in your zul file:

<calendars model="@load(vm.simpleCalendarModel)" 
           onEventCreate="@command('insertNewActivity')" ... />

in your ViewModel:

@Command
@NotifyChange({/*"simpleCalendarModel",*/"showInsertNewActivity", "activitySession"})
public void insertNewActivity(@ContextParam(ContextType.TRIGGER_EVENT) CalendarsEvent event) {
    setShowInsertNewActivity(true);
    //System.out.println(event.toString());
}

I commented out "simpleCalendarModel" from the notify list. It should not be necessary to notify-change the whole SimpleCalendarModel. Updates within the model (adding/removing events) will update the UI automatically (if not please post a bug with steps to reproduce the issue) the Calendar component listens to data changes triggered within the CalendarModel.

Only if you create a new instance and assign it to simpleCalendarModel you have to notify-change the variable.

Robert

the @NotifyChange annotation only works in combination with @Command.

In your case you should try something like this in your zul file:

<calendars model="@load(vm.simpleCalendarModel)" 
           onEventCreate="@command('insertNewActivity')" ... />

in your ViewModel:

@Command
@NotifyChange({/*"simpleCalendarModel",*/"showInsertNewActivity", "activitySession"})
public void insertNewActivity(@ContextParam(ContextType.TRIGGER_EVENT) CalendarsEvent event) {
    setShowInsertNewActivity(true);
    //System.out.println(event.toString());
}

I commented out "simpleCalendarModel" from the notify list. It should not be necessary to notify-change the whole SimpleCalendarModel. Updates within the model (adding/removing events) will update the UI automatically because the Calendar component listens to data changes triggered within the CalendarModel (if not please post a bug with steps to reproduce the issue) the Calendar component listens to data changes triggered within the CalendarModel.issue).

Only if you create a new instance and assign it to simpleCalendarModel you have to notify-change the variable.

Robert

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