使用 Primefaces 日历清除日期选择

2024-03-03

有什么方法可以清除使用 prime faces 日历的日期选择吗?

<p:calendar pattern="MM/dd/yyyy" navigator="true" id="endDate" for="endDate"
readonlyInput="true" mindate="#{manageMarketingProgramsBean.currentDate}" showOn="button">
<f:convertDateTime pattern="MM/dd/yyyy" timeZone="America/New_York" />
</p:calendar>

我有 readonlyInput="true" 因为我不希望用户输入日期。我强迫他们从日历中选择日期,需要有另一种方法来为用户提供清除所选日期的能力。请让我知道如何实现这一目标?


我想到的第一个方法是:

<p:calendar readonlyInput="true" widgetVar="calendarWidget"/>     
<p:commandButton value="Reset" onclick="calendarWidget.setDate(null)"/>   
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 Primefaces 日历清除日期选择 的相关文章

随机推荐