使用Primefaces日历清除日期选择 [英] Clear Date Selection using Primefaces Calendar

查看:127
本文介绍了使用Primefaces日历清除日期选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以使用素面日历清除日期选择?

Is there any way to clear the date selection using prime faces calendar?

<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",因为我不希望用户键入日期.我强迫他们从日历中选择日期,需要有另一种方式为用户提供清除所选日期的能力.请让我知道我该如何实现?

I have readonlyInput="true" because I dont want user to type the date. I force them to pick the date from the calendar, there needs to be another way to provide user the ability to clear the date selected. Please let me know how can I achieve this?

推荐答案

我想到的第一种方法是:

The first approach that comes into my mind would be:

<p:calendar readonlyInput="true" widgetVar="calendarWidget"/>     
<p:commandButton value="Reset" onclick="calendarWidget.setDate(null)"/>   

这篇关于使用Primefaces日历清除日期选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆