Primefaces 5.2 日历未定义

Primefaces 5.2 calendar is undefined

我正在将我的 Primefaces 版本从 3.0.1 升级到 5.2。 我现在使用的是 myFaces 2.2.8 和 Primefaces 5.2。这次升级破坏了我的 primefaces 日历,我不知道发生了什么:

我在 p:calendar 中使用:widgetVar="calendar" 但我无法再访问 javascript 变量 calendar

这是我的示例页面:

    <h:body>
    <p:calendar popupIconOnly="true"
                showOn="button"
                id="validityCalendar"
                locale="fr" 
                navigator="true"
                disabledWeekends="true" 
                style="padding-left:5px; padding-right:5px;"
                widgetVar="calendar" size="10" />
   <script type="text/javascript">
   $(function() {
    calendar.jqEl.datepicker("option", {maxDate : "11/07/2016", onChangeMonthYear : onChangeMonthYear});
   });
   </script>
</h:body>

我收到这个错误:

ReferenceError: calendar is not defined

除了 Primefaces 之外,我不包括另一个 jquery 或 jquery-ui。 popupIconOnly 也不起作用,但这是另一个话题...

ReferenceError: calendar is not defined

从 PrimeFaces 4.0 开始,您需要使用 PF('widgetVar') 而不是 widgetVar,即 PF('calendar').

  • What does the PF function do in Primefaces?

The popupIconOnly does not work either but this is another topic...

popupIconOnly 属性已从 PrimeFaces 5.0

中删除