-
FEATURED COMPONENTS
First time here? Check out the FAQ!
NotifyChange doesn't work in onEventCreate of the zk calendar. I tried the code as a command triggered by a button and it worked, but with the calendar oncreate it doesn't.
private boolean showInsertNewActivity=false;
public boolean isShowInsertNewActivity() {
return showInsertNewActivity;
}
public void setShowInsertNewActivity(boolean showInsertNewActivity) {
this.showInsertNewActivity = showInsertNewActivity;
}
@NotifyChange({"simpleCalendarModel","showInsertNewActivity", "activitySession"})
public void onEventCreate(CalendarsEvent event) {
setShowInsertNewActivity(true);
//System.out.println(event.toString());
}
<if test="@load(vmApp.showInsertNewActivity)">
Some Code
</if>
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).
Only if you create a new instance and assign it to simpleCalendarModel
you have to notify-change the variable.
Robert
Asked: 2017-09-28 00:39:18 +0800
Seen: 8 times
Last updated: Sep 28 '17
zkspringmvc jar licence is GPL ?
Build web application without any zul files
Custom component that extends Textbox does not fire onChange event
java.lang.NullPointerException to update to zk 8.0.1
"Spring Session" + ZK + "Spring core" @Listen method refresh the screen
zk8 client side binding to a viewmodel command seems not to work
upload event dialog do not open in browser
Notification is not shown inside sticky block
Where can I find documentation (like ZK Developer's Reference) for ZK 8.0.2.2 ?