<p:calendar> losing hours/minutes when Ajax enabled

UI Components for JSF
Post Reply
User avatar
jim@jimtough.com
Posts: 142
Joined: 03 Jun 2011, 18:06
Location: Canada

09 Jun 2011, 14:12

I am using the <p:calendar> control in popup mode with date and time shown and with a child Ajax element to allow Ajax updates when the calendar values change. What I'm seeing is the calendar value changes as expected when I click on a day or when I click on the "Now" button in the popup. However, if I use the hours or the minutes sliders, the time changes in the popup display but is not updated anywhere else. Even if I click on a non-Ajax submit button after the popup is closed, the hours and minutes changes are lost. My <p:calendar> instance is inside a composite component, but this does not seem to be related to the problem.

Here is the relevent code for the composite component :

Code: Select all

	<composite:implementation>
		<p:calendar
				value="#{cc.attrs.dateValue}" 
				pattern="#{cc.attrs.pattern}"
				readOnlyInputText="true"
				showButtonPanel="true"
				showOn="button"
				mode="popup"
				alt="#{cc.attrs.tooltip}"
				title="#{cc.attrs.tooltip}"
				required="#{cc.attrs.required}"
				label="#{cc.attrs.label}">
			<f:ajax 
					event="valueChange" 
					render="@this #{cc.attrs.ajaxRenderTargets}" />
		</p:calendar>
	</composite:implementation>
I have also tried with <p:ajax> instead of <f:ajax> (using 'update' instead of 'render') but the result is the same.

Here is the relevant code from the Facelet page:

Code: Select all

	<ui:define name="content">
		<h:form id="calendarForm" >
			<h:panelGrid columns="1">
				<p:messages 
						id="calendarMessages" 
						showSummary="false" 
						showDetail="true" />
				<sandbox:primeFacesCalendarCC
						id="primeFacesCalendarCC"
						dateValue="#{primeFacesTestBean.userSubmittedDateTime}"
						ajaxRenderTargets=":calendarForm:calendarMessages :ajaxRenderTargetsInTemplate"
						required="true" />
				<h:commandButton
						id="commandButtonSubmit"
						value="Submit" />
				<h:commandButton
						id="commandButtonBackToStartPage" 
						value="#{bundle.backToStartPage}"
						action="start"
						immediate="true" />
			</h:panelGrid>
		</h:form>
	</ui:define>
I have tried it with the PF 3 M2 snapshot from a few days ago, and with the M2 snapshot for today (2011-06-09). Anyone else experiencing this problem?

Thanks,
Jim
PF 3.0,
Mojarra 2.1.4,
Tomcat 7.0.14,
Eclipse Indigo,
IE 7, Chrome

Image
http://stackoverflow.com/users/346112/jim-tough

Would rather be a Decepticon...

User avatar
jim@jimtough.com
Posts: 142
Joined: 03 Jun 2011, 18:06
Location: Canada

14 Jun 2011, 14:25

Solved my own problem. I wasn't using the component correctly. I added an Ajax tag that handles the "changed" event and stopped rendering "@this".

Code: Select all

      <p:calendar
            value="#{cc.attrs.dateValue}" 
            pattern="#{cc.attrs.pattern}"
            readOnlyInputText="true"
            showButtonPanel="true"
            showOn="button"
            mode="popup"
            alt="#{cc.attrs.tooltip}"
            title="#{cc.attrs.tooltip}"
            required="#{cc.attrs.required}"
            label="#{cc.attrs.label}">
         <f:ajax 
               event="valueChange" 
               render="#{cc.attrs.ajaxRenderTargets}" />
         <f:ajax 
               event="change" 
               render="#{cc.attrs.ajaxRenderTargets}" />
      </p:calendar>
PF 3.0,
Mojarra 2.1.4,
Tomcat 7.0.14,
Eclipse Indigo,
IE 7, Chrome

Image
http://stackoverflow.com/users/346112/jim-tough

Would rather be a Decepticon...

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 51 guests