PrimeFaces TypeError:PF(...)未定义 [英] PrimeFaces TypeError: PF(...) is undefined

查看:112
本文介绍了PrimeFaces TypeError:PF(...)未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PrimeFaces上关注了DataTable过滤器展示自己的数据表.每次发生"onkeyup"事件时,我都会得到一个

I followed the DataTable Filter showcase from PrimeFaces on my own DataTable. Every time the "onkeyup" event occurs I get a

TypeError:PF(...)是Firebug中的未定义错误,并且是未捕获的" TypeError:无法读取未定义的属性过滤器"

TypeError: PF(...) is undefined error in Firebug and a "Uncaught TypeError: Cannot read property 'filter' of undefined

在Chrome控制台中

.过滤不起作用.

in Chrome Console. The filtering does not work.

这是我的XHTML页面:

Here is my XHTML page:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <h:title>List of User</h:title>
    </h:head>

    <h:body>
        <h:form id="UserForm" name="UserRecords">
            <p:dataTable id="users" widgetVar="usersTable" var="user" value="#{userBean.users}" scrollable="false" frozenColumns="0" sortMode="multiple" stickyHeader="true" filteredValue="#{userBean.filteredUsers}">
                <f:facet name="header">User<p:inputText id="globalFilter" onkeyup="PF('usersTable').filter()" style="float:right" placeholder="Filter"/>
                    <p:commandButton id="toggler" type="button" style="float:right" value="Columns" icon="ui-icon-calculator"/>
                    <p:columnToggler datasource="users" trigger="toggler"/>
                    <p:commandButton id="optionsButton" value="Options" type="button" style="float:right"/>
                    <p:menu overlay="true" trigger="optionsButton" my="left top" at="left bottom">
                        <p:submenu label="Export">
                            <p:menuitem value="XLS">
                                <p:dataExporter type="xls" target="users" fileName="users"/>
                            </p:menuitem>
                            <p:menuitem value="PDF">
                                <p:dataExporter type="pdf" target="users" fileName="users"/>
                            </p:menuitem>
                            <p:menuitem value="CSV">
                                <p:dataExporter type="csv" target="users" fileName="users"/>
                            </p:menuitem>
                            <p:menuitem value="XML">
                                <p:dataExporter type="xml" target="users" fileName="users"/>
                            </p:menuitem>
                        </p:submenu>
                    </p:menu>
                </f:facet>
                <p:column disabledSection="false" colspan="1" exportable="true" filterBy="#{user.firstName}" filterMatchMode="startsWith" filterStyle="display:none; visibility:hidden;" filterable="true" headerText="FirstName" priority="0" rendered="true" resizable="true" rowspan="1" selectRow="true" sortable="true" toggleable="true" visible="true">
                    <h:outputText value="#{user.firstName}"/>
                </p:column>
                <p:column disabledSection="false" colspan="1" exportable="true" filterBy="#{user.lastName}" filterMatchMode="startsWith" filterStyle="display:none; visibility:hidden;" filterable="true" headerText="LastName" priority="0" rendered="true" resizable="true" rowspan="1" selectRow="true" sortable="true" toggleable="true" visible="true">
                    <h:outputText value="#{user.lastName}"/>
                </p:column>
                <p:column disabledSection="false" colspan="1" exportable="true" filterBy="#{user.username}" filterMatchMode="startsWith" filterStyle="display:none; visibility:hidden;" filterable="true" headerText="Username" priority="0" rendered="true" resizable="true" rowspan="1" selectRow="true" sortable="true" toggleable="true" visible="true">
                    <h:outputText value="#{user.username}"/>
                </p:column>
                <p:column disabledSection="false" colspan="1" exportable="true" filterBy="#{user.password}" filterMatchMode="startsWith" filterStyle="display:none; visibility:hidden;" filterable="true" headerText="Password" priority="0" rendered="true" resizable="true" rowspan="1" selectRow="true" sortable="true" toggleable="true" visible="true">
                    <h:outputText value="#{user.password}"/>
                </p:column>
                <p:column disabledSection="false" colspan="1" exportable="true" filterBy="#{user.id}" filterMatchMode="startsWith" filterStyle="display:none; visibility:hidden;" filterable="true" headerText="Id" priority="0" rendered="true" resizable="true" rowspan="1" selectRow="true" sortable="true" toggleable="true" visible="true">
                    <h:outputText value="#{user.id}"/>
                </p:column>
                <p:column disabledSection="false" colspan="1" exportable="true" filterBy="#{user.createdOn}" filterMatchMode="startsWith" filterStyle="display:none; visibility:hidden;" filterable="true" headerText="CreatedOn" priority="0" rendered="true" resizable="true" rowspan="1" selectRow="true" sortable="true" toggleable="true" visible="true">
                    <h:outputText value="#{user.createdOn}"/>
                </p:column>
                <p:column disabledSection="false" colspan="1" exportable="true" filterBy="#{user.lastModified}" filterMatchMode="startsWith" filterStyle="display:none; visibility:hidden;" filterable="true" headerText="LastModified" priority="0" rendered="true" resizable="true" rowspan="1" selectRow="true" sortable="true" toggleable="true" visible="true">
                    <h:outputText value="#{user.lastModified}"/>
                </p:column>
            </p:dataTable>
        </h:form>
    </h:body>
</html>

我正在使用带有Mojarra 2.2.8和JSF 2.2.10的PrimeFaces 5.2.

I'm using PrimeFaces 5.2 with Mojarra 2.2.8 and JSF 2.2.10.

推荐答案

运行时类路径包含重复的不同版本的库时,可能会发生这种情况.然后在类加载和资源解析期间会发生冲突.

That can happen when the runtime classpath is dirty of duplicate different versioned libraries. Conflicts would then occur during class loading and resource resolving.

确保仅使用一个版本的库.这不仅适用于PrimeFaces,而且适用于Mojarra.同时拥有2.2.8和2.2.10绝对不正确.

Make sure that you're using only one version of a library. This not only applies to PrimeFaces, but also to Mojarra. Having both 2.2.8 and 2.2.10 is definitely not right.

这篇关于PrimeFaces TypeError:PF(...)未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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