0

我是 jQuery 和PrimeUI的新手。需要你的帮助。我不断收到错误:

(index):8 Uncaught TypeError: jQuery(...).puidatatable is not a function at (index):8

代码:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:p="http://primefaces.org/ui">
<f:view>
    <h:head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <title>Product</title>
        <script type="text/javascript">
        jQuery('#tblremoteeager').puidatatable({
                caption : 'Remote Restful Webservice - Eager',
                paginator : {
                    rows : 10
                },
                columns : [ {
                    field : 'name',
                    headerText : 'Name'
                }, {
                    field : 'email',
                    headerText : 'Email'
                } ],
                datasource : function(callback) {
                    jQuery.ajax({
                        type : "GET",
                        url : 'http://localhost:8080/findAll',
                        dataType : "json",
                        context : this,
                        success : function(response) {
                            callback.call(this, response);
                        }
                    });
                }
            });
        </script>
    </h:head>
    <h:body>
    <div id="tblremoteeager"></div>
        <div class="ui-g">
            <div class="ui-g-12">
                <p:toolbar>
                    <f:facet name="left">
                        <p:button href="/" value="List of Products" />
                        <p:button href="/product" value="New Product" />
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-g-12">
                <ui:insert name="content" />
            </div>
        </div>
    </h:body>
</f:view>
</html>

我怎样才能摆脱它?我尝试按照:https ://www.primefaces.org/primeui/#datatable

4

1 回答 1

0

我发现我没有包括图书馆。 https://raw.githubusercontent.com/primefaces/primeui-distribution/master/primeui-all.js

于 2017-09-06T18:51:25.720 回答