问题
I have two primefaces calender controls.I want that when I select a date from the first calender then next calender mindate should be start from 1st calender's selected date.For instance, I have selected 7/5/2013
then next calender should disable all dates before 8/5/2013
This is what I have tried so far but it is not working
<p:calendar id="fromD" value="#{requestController.from}" yearRange="2013:2015" pattern="dd/MM/yyyy" mindate="#{requestController.today}"/>
<p:calendar id="toD" value="#{requestController.to}" yearRange="2013:2015" pattern="dd/MM/yyyy" mindate="#{requestController.from}"/>
Any suggestions?
回答1:
From change
event , you can't submit the value of date.You need to change the event to dateSelect
Just do
<p:ajax event="dateSelect" update="toD"/>
It will reset the mindate for your next calender/component
回答2:
I would recommend you to do the following:
<p:ajax event="dateSelect" update="toD" global="false" />
<p:ajax event="change" update="toD" global="false" />
It will reset the mindate on both events.
来源:https://stackoverflow.com/questions/16392677/primefaces-calender-how-to-set-dynamically-mindate