This content has been marked as final.
Show 6 replies
-
1. Re: getData(...) of CalendarDataModel not called
orribl Dec 11, 2009 9:41 AM (in response to orribl)Hi,
no ideas...? -
2. Re: getData(...) of CalendarDataModel not called
nbelaevski Dec 13, 2009 7:57 PM (in response to orribl)Hi,
Please post page and bean code.
-
3. Re: getData(...) of CalendarDataModel not called
orribl Dec 14, 2009 5:59 AM (in response to nbelaevski)Hi Nick,
sure. Here's the code of the xhtml page:
<rich:calendar value="#{calendarBean.date}" popup="false" showApplyButton="false" cellWidth="100px" cellHeight="100px" showWeeksBar="true" dataModel="#{calendarDataModel}" id="calendar_organizer" showFooter="false" > <a4j:outputPanel layout="block" id="cell" style="height: 100%;" > <h:panelGrid columns="1"> <h:outputText value="{day}" style="align:center"/> <h:outputText style="white-space:nowrap;" value="{data.shortDescription}" escape="false"/> <h:outputText value="{data.description}" escape="false"/> </h:outputText> </a4j:outputPanel> <a4j:support event="onchanged" reRender="calendar_todaysTasks,calendar_todaysAppointments" /> </rich:calendar>
Here's the getData()-implementation of the #{calendarDataModel} (request scope):
public CalendarDataModelItem[] getData(Date[] dateArray) { if (dateArray == null) { return null; } items = new CalendarDataModelItem[dateArray.length]; for (int i = 0; i < dateArray.length; i++) { items[i] = createDataModelItem(dateArray[i]); } return items; } protected CalendarDataModelItem createDataModelItem(Date date) { CalendarDataModelItemImpl item = new CalendarDataModelItemImpl(); ArrayList<IAppointment> appointments = this.sessionFassade.getAppointments(date); ArrayList<ITask> tasks = this.sessionFassade.getTasks(date); Map<String, String> data = new HashMap<String, String>(); String appointmentOutput = ""; for ( int i = 0; i < appointments.size(); i++){ if ( i > 0 ){ appointmentOutput += "<br />"; } appointmentOutput += "» [A]" + appointments.get(i).getSubject(); } for ( int i = 0; i < tasks.size(); i++){ if ( appointments.size() > 0 ){ appointmentOutput += "<br />"; } appointmentOutput += "» [T]" + tasks.get(i).getSubject(); } data.put("shortDescription", appointmentOutput); data.put("description", ""); Calendar c = Calendar.getInstance(); c.setTime(date); item.setDay(c.get(Calendar.DAY_OF_MONTH)); item.setEnabled(true); item.setStyleClass("rel-hol"); item.setData(data); return item; }
-
4. Re: getData(...) of CalendarDataModel not called
orribl Dec 15, 2009 10:35 AM (in response to orribl)Some more details regarding the environment:
Richfaces 3.3.2 SR1
Myfaces 1.2.8
Tomact 6.0.18
-
5. Re: getData(...) of CalendarDataModel not called
ilya_shaikovsky Dec 15, 2009 10:58 AM (in response to orribl)you not defined mode.
default mode value is client so no requests occurs on month change.
in client mode if preload range dates not defined - data loaded only for current month.
so you have to define mode="ajax" or define preload range for client side calendar.
-
6. Re: getData(...) of CalendarDataModel not called
orribl Dec 15, 2009 11:06 AM (in response to orribl)Great, thanks. Now it works as expected.