I am trying to build a calendar of 3 months using the SmartGWT Calendar component (Compact Calendar). So far I was succeeded in portraying all the requirements, except the color coding of each cell in the calendar. The requirement is to show the dates in Red/Green/Yellow based on the priority.
I am trying the below code sample to show the red color on alternate days.
@Override
protected String getDayBodyHTML(Date date, CalendarEvent[] events, Calendar calendar, int rowNum, int colNum) {
String returnStr = date.getDate() + "";
if(date.getDate()%2 == 0) {
calendar.setDayBodyBaseStyle("calMonthDayBodyH");
} else {
calendar.setDayBodyBaseStyle("calMonthDayBody");
}
return returnStr;
}
Using the above code snippet I got the calendar like the chess board, which is perfect.
When I check the Style of the cell where the date is an odd number in Firebug it is showing as "calMonthDayBodyH" as expected, but the problem is when I mouse over on that date, the style is changing to "calMonthDayBodyOver" instead of "calMonthDayBodyHOver" and when the mouse out is performed it is setting the class name back to “calMonthDayBody”, hence the style is lost.
Can you please let me know what is the solution to overcome this problem?
I am trying the below code sample to show the red color on alternate days.
@Override
protected String getDayBodyHTML(Date date, CalendarEvent[] events, Calendar calendar, int rowNum, int colNum) {
String returnStr = date.getDate() + "";
if(date.getDate()%2 == 0) {
calendar.setDayBodyBaseStyle("calMonthDayBodyH");
} else {
calendar.setDayBodyBaseStyle("calMonthDayBody");
}
return returnStr;
}
Using the above code snippet I got the calendar like the chess board, which is perfect.
When I check the Style of the cell where the date is an odd number in Firebug it is showing as "calMonthDayBodyH" as expected, but the problem is when I mouse over on that date, the style is changing to "calMonthDayBodyOver" instead of "calMonthDayBodyHOver" and when the mouse out is performed it is setting the class name back to “calMonthDayBody”, hence the style is lost.
Can you please let me know what is the solution to overcome this problem?
Comment