-
1. Rich Calender isDayEnabled works only once
mrras Mar 2, 2011 5:19 AM (in response to mrras)Any ideas about this one?
-
2. Re: Rich Calender isDayEnabled works only once
ilya_shaikovsky Mar 2, 2011 5:39 AM (in response to mrras)1 of 1 people found this helpfulcalendar performs markup calculation only once. And it can't know that something changed on the page and it need to re-evaluate the markup. Let's me look to the code slightly later in order to check if you could trigger such update manually.
easiest way to perform re-render.. but that is not probably optimal to use request to server for pure client operation.
-
3. Re: Rich Calender isDayEnabled works only once
mrras Mar 3, 2011 4:45 AM (in response to ilya_shaikovsky)Thanks for your answer.
Indeed using a server request for a client operation is not the best solution, but it is the only one I have so far, so I tried it and it works!
well. almost.
I implemented the rerender by adding a4j support tag:
{code}
<rich:calendar id="startDate" value="#{selectorsMB.startDate}" showWeeksBar="false"
isDayEnabled="dayEnabledStart" dayStyleClass="disabledClassStart"
cellWidth="24px" cellHeight="22px" style="width:80px" showFooter="false">
<a4j:support event="onchanged" reRender="endDateWrap"
onsubmit="resetRangeSelector();switchNeedToResend(true);"/>
</rich:calendar>
{code}
The issue I'm facing now is with a predefined date selector I have next to the date boxes.it has several values like "last 28 days", "last month", "last week", etc... and changing it fires a js function that alters the dates like this (after calculating fromDate and toDate):
{code}
Richfaces.getComponent('calendar',document.getElementById("selectors:selectorsform:startDate"))
.selectDate(fromDate);
Richfaces.getComponent('calendar',document.getElementById("selectors:selectorsform:endDate"))
.selectDate(toDate);
{code}
the result is that startDate changes but endDate doesn't. it flickers to the wanted date but then returns the the previously selected date.
What I believe happens is that after the first selectDate happens (on startDate) the reRender for endDate starts, and it ends after the selectDate for this calender has already executed, so the value changes back to the previous value.
So, is there a way to fire an event to trigger the isDayEnabled and dayStyleClass functions from the client? that will probably solve my problem.
if not, how do you think I should progress with this issue? I tried adding oncomplete event to one of the calendars a4j support but it ended with just more flickering and incosistant behaviour.
Thanks in advance!
-
4. Re: Rich Calender isDayEnabled works only once
mrras Mar 7, 2011 4:17 AM (in response to mrras)Any ideas about this?
Thanks in advance.
-
5. Rich Calender isDayEnabled works only once
mrras Mar 9, 2011 4:07 AM (in response to ilya_shaikovsky)Did you find any hook to trigger the markup from the client? this is becoming a real issue for me now.
Thanks again.
-
6. Re: Rich Calender isDayEnabled works only once
garytxo May 30, 2011 6:24 AM (in response to mrras)Hi there
we have something similar in our project, we refresh the departure date calendar by re-rendering on the "onchanged" event on the start date calendar.
<rich:calendar id="arrivalDate" value="#{bean.arrivalDate}" isDayEnabled="disableArrivalDays" onchanged="#{rich:component('depatureDate')}.render();"/>
Hope this is useful?