如何在JSF中调用JS函数?

时间:2018-06-12 06:40:13

标签: javascript java jsf

如何在JSF上调用JS函数,在浏览器控制台中写入该函数未定义。

<p:selectCheckboxMenu value="#{managedBean.filterDepartmentIds}" id="emdepartmentList" widgetVar="emdepartmentList"
  label=" "
  required="#{empty managedBean.filterDepartmentIds}"
  rendered="#{managedBean.isCreateMode}"
   styleClass="-fill">
 <p:ajax update="toolTipFade"/>
 <p:ajax process="@this" update="toolTipFade" event="change"
                                oncomplete="selectCheckbox();"/>

我的JS功能:

    <script type="text/javascript">
    function selectCheckbox() {
        var a = "#{managedBean.departmentList.size()}";
        var b = "#{msg['all']}";
        if (PF('emdepartmentList').inputs.filter(':checked').length === a ){
            PF('emdepartmentList').label.text(b);
        } else {
            if (PF('emdepartmentList').inputs.filter(':checked').length === 0) {
                PF('emdepartmentList').label.text(' ');
            } else {
                PF('emdepartmentList').label.text('...');
            }
        }
    }
</script>

0 个答案:

没有答案