-
Notifications
You must be signed in to change notification settings - Fork 89
FullCalendar Event getStart() Exception #95
Comments
Scratch that (that = my PR). It seems FullCalendar is doing some magic with the Event object:
So, at some point, the The getter would have to take that into account with something like:
But then the same has to be done for Baaaah, the style this class (and the rest of FullCalendar) is written is driving me mad - |
I solved this problem by keeping a copy of the calendar event data in an external Map, referenced by the ID you pass into each event on creation. Edit: I realize that this is probably not necessary on callback, but I found it safer to just assume Event.getMethods won't work. Map<String, CalData> calCache = new HashMap();
protected void loadEvents() {
for (CalData eventData : events) {
String uniqEventID = Document.get().createUniqueId();
calCache.put(uniqEventID, eventData);
Event calEvent = new Event(uniqEventID, "" + data.getSumm());
calendar.addEvent(calEvent);
}
}
ClickAndHoverConfig clickHover = new ClickAndHoverConfig(new ClickAndHoverEventCallback() {
public void eventClick(JavaScriptObject calendarEvent, NativeEvent event, JavaScriptObject viewObject) {
Event calEvent = new Event(calendarEvent);
onCalendarEventClick(calEvent.getId());
}
} Also if anyone is having problems loading data into the calendar, it has to initialize past a certain point for .addEvent to work correctly. I wanted to wrap the calendar to automatically cache & delay calls to addEvent, and give the code to the community, but for some reason it only sometimes worked. Eventually I ran out of time and found that the the suggested way in the documentation seems to always work: fc = new FullCalendar("uniqueCalendarID", ViewOption.month, calendarConfig, false);
fc.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
loadEvents(); // See above
}
}); |
While adding events to the FullCalendar extra, the org.gwtbootstrap3.extras.fullcalendar.client.ui.Event.getStart() consistently throws a JavaScriptException saying that "theInstance[1507516].start.toDate is not a function"
To test this, I have created a clean GWT Project and added the following lines:
(In file com.fullcalendartest.client.FullCalendarTest.java:113-115)
Which throws:
I have packaged the clean eclipse project (uses standard Dev plugin via old firefox instance): https://dl.dropboxusercontent.com/u/424887/FullCalendarTest.tar.bz2
I will work around the problem for now and look forward to learning more about JSNI so that I can fix these types of problems in the future.
Thank you,
Jason B.
Edit: I am using version 0.8.1
The text was updated successfully, but these errors were encountered: