Richfacess日历|月份选择器|数据未提交

时间:2015-03-02 11:08:10

标签: jsf datepicker calendar richfaces

我正在尝试使用Richfaces日历作为月份选择器而不是日期选择器。虽然以下代码标签按预期显示月份选择器,但所选月份和年份的值未提交给Backing Bean。

----- XHTML标签----

<rich:calendar id="fromDate"
                currentDate="#{numberManagementController.searchCriteria.fromDate}"
                value="#{numberManagementController.searchCriteria.fromDate}"
                showWeekDaysBar="false" datePattern="MMM-yyyy" showFooter="false"
                popup="false" enableManualInput="false" showInput="false"
                styleClass="numberMonthSelector" popupClass="numberCalendarPopup"
                oncurrentdateselect="event.rf.component.__selectDate(event.rf.data)" />



<rich:calendar id="toDate" showWeekDaysBar="false" showFooter="false"
                    currentDate="#{numberManagementController.searchCriteria.toDate}"
                    value="#{numberManagementController.searchCriteria.toDate}"
                    oncurrentdateselect="event.rich.component.selectDate(event.rich.date)"
                    popup="false" styleClass="numberMonthSelector" popupClass="numberCalendarPopup"/>

----- CSS -------

.numberMonthSelector tr[id$="CalendarDateEditorLayoutTR"]
    {
        display: none;
    }

    .numberCalendarPopup tr[id]{
        display:none;
    }

请帮助我,坚持这个问题几天。

初步帮助来自here

Richfaces - 4.1.0.Final

非常感谢 Sachin Jain

1 个答案:

答案 0 :(得分:0)

如果要将值发送到bean以响应某些事件,则应使用<a4j:ajax>

<rich:calendar id="fromDate"
               currentDate="#{numberManagementController.searchCriteria.fromDate}"
               value="#{numberManagementController.searchCriteria.fromDate}"
               showWeekDaysBar="false" datePattern="MMM-yyyy" showFooter="false"
               popup="false" enableManualInput="false" showInput="false"
               styleClass="numberMonthSelector" popupClass="numberCalendarPopup">
    <a4j:ajax event="currentdateselect" 
              onbeforesubmit="event.rf.component.__selectDate(event.rf.data)" 
              execute="@this"/>
</rich:calendar>