Bonjour,

Je souhaite utiliser un Datatable du framework PrimeUI (PrimeFaces), mais aucun résultat ne s'affiche !

J'ai pourtant copié/collé le code à partir d'une démo du site.

Note : j'utilise netBeans pour IDE. Je n'ai pas déclaré PrimeFaces dans mon projet. J'ai téléchargé la version (dernière) 4.1.15 de PrimeUI et déclaré le .jar comme librairie du projet.

MERCI POUR VOTRE AIDE... si indispensable !!!


Voici mon code HTML, puis JavaScript :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<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:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <h:head>
        <link rel="stylesheet" href="%PATH%/theme.css" />
        <link rel="stylesheet" type="text/css" href="%PATH%/font-awesome.css" />
        <link rel="stylesheet" href="%PATH%/jquery-ui.css" />
        <link rel="stylesheet" href="%PATH%/primeui.min.css" />
        <link href="monstyle.css" rel="stylesheet" type="text/css"/>

        <script type="text/javascript" src="%PATH%/jquery.js"></script>
        <script type="text/javascript" src="%PATH%/jquery-ui.js"></script>
        <script type="text/javascript" src="%PATH%/primeui.min.js"></script>
        <script type="text/javascript" src="script.js"></script>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

        <title>Projet Jen-Ol-D</title>
    </h:head>

    <h:form>
        <h:body>
            <a href="#" onclick="tbllocal"> this is a link! </a>
        </h:body>        
    </h:form>
</html>

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<script type="text/javascript">
    $(function() {
        var localData = [
        {'brand': 'Volkswagen', 'year': 2012, 'color': 'White', 'vin': 'dsad231ff'},
            {'brand': 'Audi', 'year': 2011, 'color': 'Black', 'vin': 'gwregre345'},
            {'brand': 'Renault', 'year': 2005, 'color': 'Gray', 'vin': 'h354htr'},
            {'brand': 'BMW', 'year': 2003, 'color': 'Blue', 'vin': 'j6w54qgh'},
            {'brand': 'Mercedes', 'year': 1995, 'color': 'White', 'vin': 'hrtwy34'},
            {'brand': 'Volvo', 'year': 2005, 'color': 'Black', 'vin': 'jejtyj'},
            {'brand': 'Honda', 'year': 2012, 'color': 'Yellow', 'vin': 'g43gr'},
            {'brand': 'Jaguar', 'year': 2013, 'color': 'White', 'vin': 'greg34'},
            {'brand': 'Ford', 'year': 2000, 'color': 'Black', 'vin': 'h54hw5'},
            {'brand': 'Fiat', 'year': 2013, 'color': 'Red', 'vin': '245t2s'}
        ];
 
        $('#tbllocal').puidatatable({
                caption: 'Local Datasource',
                columns: [
                {field: 'vin', headerText: 'Vin'},
                {field: 'brand', headerText: 'Brand'},
                {field: 'year', headerText: 'Year'},
                {field: 'color', headerText: 'Color'}
            ],
            datasource: localData
        });
 
        $('#tblremoteeager').puidatatable({
         ...
         ...