I am working with Calendar Widget. One of my needs is to modify an Event Window style (color, border etc) for a particular Event while I am in a OnEventClick event handler.
This is what I tried and does NOT work.
The purpose of the code is to change the Event style to show that a an event is selected when clicked.....
The above code does not work as expected. There is no effect unless user takes action equivalent to complete view refresh.
But if user goes to other view and comes back then the changed attribute will take effect.
An alternative is to do following in the event handler after the attribute change-
//cal is calendar instance
cal.setData(cal.getData()); //fallback technique
But this is very expensive operation.
Any suggestions how to only update style?
This is what I tried and does NOT work.
The purpose of the code is to change the Event style to show that a an event is selected when clicked.....
Code:
........... @Override public void onEventClick(CalendarEventClick e) { CalendarEvent event = e.getEvent(); //'sele' is a CalendarEvent instance variable. This holds last selected event... if (sele != null) { // show last event unselected sele.setAttribute("EventStyle", "eventWindow"); } // show new event selected event.setAttribute("EventStyle", "selectedEvent"); if (sele != event) { sele = event; // cal.setData(cal.getData()); //fallback technique /* dont show Edit windows if no control pressed*/ if (!e.isCtrlKeyDown()) { e.cancel(); } }
But if user goes to other view and comes back then the changed attribute will take effect.
An alternative is to do following in the event handler after the attribute change-
//cal is calendar instance
cal.setData(cal.getData()); //fallback technique
But this is very expensive operation.
Any suggestions how to only update style?
Comment