我有一个primefaces日历有事件更改listerner

时间:2018-04-11 12:31:34

标签: jsf primefaces

这是我写的代码

<p:calendar mindate="#{BackingBean.displayMinimumDate}" requiredMessage="This calendar field is required" value="#{BackingBean.displayCurrentDate}"  id="calendarRevoteId" disabled="#{BackingBean.showingRevoteCalendarField}" valueChangeListener="#{BackingBean.processValueChange}"></p:calendar>

我写过radiobutton

 <h:form id="form">
   <p:selectOneRadio id="resultVotingAction" value="#{votingResult.stakeHolderVoteVO.votingResult}"
                     rendered="#{votingResult.renderVotingOption}" styleClass="votingRadioControl">
     <f:selectItem itemLabel="Approve" itemValue="Approve" />
     <f:selectItem itemLabel="Reject" itemValue="Reject" />
     <f:selectItem itemLabel="Request More Info" itemValue="Request More Info" />
     <f:selectItem itemLabel="Revote" itemValue="Revote" />
     <p:ajax listener="#{BackingBean.renderingCalendar}"  update="form:calendarRevoteId"/>                         
   </p:selectOneRadio>
 </h:form>

我得到的问题是processValuechange方法调用第二次点击,一切正常,首先点击它不工作

1 个答案:

答案 0 :(得分:0)

尝试将showOn="Button"添加到您的日历中。这是Primeface&#34;客户端事件,显示弹出日历&#34;。

            <p:calendar showOn="Button"
                        mindate="#{BackingBean.displayMinimumDate}"
                        requiredMessage="This calendar field is required"
                        value="#{BackingBean.displayCurrentDate}"
                        id="calendarRevoteId"
                        disabled="#{BackingBean.showingRevoteCalendarField}"
                        valueChangeListener="#{BackingBean.processValueChange}">
            </p:calendar>