Tags

, , , , , ,


It was on the 2nd of Feb 2009 that I came across the issue with jsf calendar component. The issues was due to the calendar renderer class rendering only four rows of  the dates as all dates fitted within that, hence the javascript error for the missing row. The quick get around over this was to add an additional row if there was only four rows.

This will be a recurring issues when all dates of feb fits perfectly on four rows of the calendar.

You can download the webui.jar with the updated CalendarMonthRendered.class on the link below.

http://www.turboupload.com/files/get/6X_JJlLLRR/webui.jar

Code added on CalendarMonthRenderer.java is as below

if(rowNum==4)
{
writer.startElement(“tr”, calendarMonth);
String rowId = rowIdPrefix + rowNum++;
writer.writeAttribute(“id”, rowId, null);
writer.write(“\n”);
for(int i = 0; i < 7; i++)
{
boolean selected = calendarMonth.isDateSelected(startDate, endDate);
boolean dayInMonth = startDate.get(2) == displayedMonth;
String style = styles[19];
if(selected)
{
if(dayInMonth)
style = styles[20];
else
style = styles[21];
} else
if(dayInMonth)
if(calendarMonth.compareDate(startDate, todaysDate))
style = styles[22];
else
style = styles[18];
renderDateLink(startDate, style, dateLinkPrefix.concat(String.valueOf(dateLinkId)), calendarMonth, writer);
dateLinkId++;
startDate.add(6, 1);
startDate.getTime();
}

writer.endElement(“tr”);
}

Hope this save a trouble for few.

Advertisements