0

ZKCalendar returns null onDayClick event

asked 2013-06-24 09:22:43 +0800

JustinFrost gravatar image JustinFrost
139 1 6

I have create a ZKCalendar with the following custom DateFormatter class:

public class LeaveCalendarDateFormatter implements DateFormatter {
    public String getCaptionByDateOfMonth(Date date, Locale locale, TimeZone timezone) {
        Calendar calThis = Calendar.getInstance(timezone, locale);
     calThis.setTime(date);
        String dayLetter = new SimpleDateFormat("EE").format(date).substring(0,1).toUpperCase();

        return "<span class=cal-dow>" + dayLetter + "</span> <span class=cal-dom>"
        + Integer.toString(calThis.get(Calendar.DAY_OF_MONTH)) + "</span>";
    }
}

This renders nicely with the day of week letters, however when I click on the day of the month, the DayClick event fires with no data:

java.lang.NumberFormatException: For input string: "null"

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Long.parseLong(Long.java:410) at java.lang.Long.parseLong(Long.java:468) at org.zkoss.calendar.event.CalendarsEvent.getLong(CalendarsEvent.java:131) at org.zkoss.calendar.event.CalendarsEvent.getClickEvent(CalendarsEvent.java:123)

I overrode the service method of Calendar to debug and the json data object on the request is NULL.

Anyone have an idea what is causing this ?? I presume it is something to do with my DateFormatter class.

Thanks for your help.

delete flag offensive retag edit

Comments

Hi JustinFrost, when you render html in month caption, the structure of ZK calendar is changed, why do you need to render span tag in month caption?

jimmyshiau ( 2013-07-17 11:59:07 +0800 )edit
Be the first one to answer this question!
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
2 followers

RSS

Stats

Asked: 2013-06-24 09:22:43 +0800

Seen: 15 times

Last updated: Jun 24 '13

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