Page 1 of 1

Editable schedule - problem with hours

Posted: 11 Aug 2011, 15:00
by awk_reg
Hi there

My problem is about basic schedule functionality which is adding events. I'd like to set start hour and end hour for each non all-day event, thus I have:

Code: Select all

	<p:schedule value="#{scheduleController.eventModel}" editable="true"
					  widgetVar="myschedule"
                eventSelectListener="#{scheduleController.onEventSelect}"
                dateSelectListener="#{scheduleController.onDateSelect}"
		onEventSelectUpdate="eventDetails" onEventSelectComplete="eventDialog.show()" 
		onDateSelectUpdate="eventDetails" onDateSelectComplete="eventDialog.show()" />         

					<p:dialog id="dialog" widgetVar="eventDialog" header="Event"
					showEffect="clip" hideEffect="clip">
					<h:panelGrid id="eventDetails" columns="2">
					
					<h:outputLabel for="title" value="Name" />
					<h:inputText id="title" value="#{scheduleController.event.title}" required="true"/>
				
					<h:outputLabel id="idStart" value="#{dialogBean.meetingStart}:" />
					<p:inputMask id="from" value="#{scheduleController.event.startDate}" mask="99/99/9999 99:99" >
					<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="#{scheduleController.timezone}" />
					</p:inputMask>

					<h:outputLabel id="idEnd" value="#{dialogBean.meetingEnd}:" />
					<p:inputMask id="idEndInput" value="#{scheduleController.event.endDate}" mask="99/99/9999 99:99"  disabled="#{dialogBean.disabled}">
					<f:convertDateTime pattern="dd/MM/yyyy 23:59" timeZone="#{scheduleController.timezone}" />
					</p:inputMask>

					<h:outputLabel id="allDayLabel" value="All day"/>
					<h:selectBooleanCheckbox id="allDayCb" >
						<p:ajax update="eventDetails" listener="#{dialogBean.updateHours}" />
					</h:selectBooleanCheckbox>
	
					<p:commandButton value="Save" actionListener="#{scheduleController.addEvent}"
					oncomplete="myschedule.update();eventDialog.hide();" />
					</h:panelGrid>
					</p:dialog>
(updateHours does nothing but disables date/hour input fields)

if event is created from day view, start hour is properly set to the hour I clicked, but after Save the event is registered under all day events at the top of the day. When opened to edit, the hour is also remembered correctly, only it's not displayed under corresponding hour but as all day event... Also while adding event from month view, if I set hours manually, they are not remembered at all...
Any ideas would be greatly appreciated.

Re: Editable schedule - problem with hours

Posted: 17 Aug 2011, 03:56
by mestremassula
Try create the event with the FALSE full-day argument (argument #4)... something like this:

Code: Select all

                eventModel.addEvent(new DefaultScheduleEvent("Champions League Match", previousDay8Pm(), previousDay11Pm(), false));

Re: Editable schedule - problem with hours

Posted: 17 Aug 2011, 21:15
by awk_reg
Thanks for your hint, unfortunately it doesn't seem to have any effect - when I change start hour in existing event, save and reopen it, start hour is the same as end hour. I cannot find any corresponding example for schedule with hour input fields so I'm kinda short of ideas..