primefaces calender: how to set dynamically mindate

…衆ロ難τιáo~ 提交于 2019-12-24 06:38:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!