Bonjour,

Je souhaite faire un tableau avec dojo grid et le peuplé en utilisant RestController et service + Dao, mais je n'arrive pas à faire le lien entre dojogrid et mon RestController voici mon code html :

Code HTML : 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr-fr" lang="fr-fr" >
<head>
	<title>Clelia - Jade</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<style type="text/css">
                @import "https://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojo/resources/dojo.css";
                @import "https://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dijit/themes/tundra/tundra.css";
                @import "https://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojox/grid/enhanced/resources/tundra/EnhancedGrid.css";
                @import "https://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css";
                @import "https://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojox/grid/resources/tundraGrid.css";
        </style>
	<link rel="stylesheet" href="style/template.css" type="text/css"/>
	<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojo/dojo.js" djConfig="parseOnLoad: true, locale: 'fr'"></script>
	<!-- TEST GRID FX -->
	<script>
                dojo.require("dojox.data.QueryReadStore");
                dojo.require("dojox.grid.EnhancedGrid");
                dojo.require("dojox.grid.enhanced.plugins.Filter");
                dojo.require("dojo.parser");
                dojo.require("dijit.form.Form");
                dojo.require("dijit.form.Button");
                dojo.require("dijit.form.FilteringSelect");
                dojo.require("dijit.form.DateTextBox");
                dojo.require("dojo/json")
                dojo.require("dojo/dom")
 
                //dom.place(JSON.stringify(data));
                
                // Appel la servlet. 
                var myStore_url = "/index.jsp"
                var myStore;
                var layout = [{
                        defaultCell: { width: 8, editable: false,
                        styles: 'text-align: center;'  },
                        rows: [
                                {field: "id", name: "id", cellStyles: "display:none", headerStyles: "display:none"},
                                {name: "IMG", field: "IMG", width: "100px"},
                                {name: "JEU", field: "JEU", width: "100px"},
                                {name: "PLATEFORME", field: "PLATEFORME", width: "100px"},
                                {name: "GENRE", field: "GENRE", width: "100px"},
                                {name: "EDITEUR", field: "EDITEUR", width: "100px"},
                                {name: "DATE DE SORTIE", field: "DATE_DE_SORTIE", width: "100px", dataType:"date"},
                                {name: "CLASSIFICATION", field: "CLASSIFICATION", width: "100px"},
                                {name: "ECONOMIQUE", field: "ECONOMIQUE", width: "100px"},
                                {name: "ACTION", field: "ACTION", width: "100px"},
                        ]
                }];
                
                var init = function(){
                        myStore = new dojox.data.QueryReadStore({url:myStore_url, jsId:"myStore",requestMethod:"post"});
                }
                /*require(["dojo/store/JsonRest"], function(JsonRest){
                        myStore = new JsonRest({target:""});
                        });*/           
 
                dojo.addOnLoad(init);
        </script>
</head>
 
<body class="tundra">
 
	<div 
		jsid="PhoneCallGrid" id="PhoneCallGrid" data-dojo-type="dojox.grid.EnhancedGrid" rowsPerPage="20" 
		escapeHtmlInData="false" columnreordering="true" data-dojo-props="store: myStore, structure:'layout'" 
		onRowClick="selectRecordI" onRowDblClick="fastTrackI" delayScroll="true" sortInfo="-2" 
		style="height:409px; width:974px;">
		<script type="dojo/method" event="postrender" args="">updateRC(this)</script>
	</div>
</body>
</html>


Voici ma méthode dans mon RestController :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
@GetMapping({ "/index", "/" })
    public List<Jeu> accueil(){
        List<Jeu> jeux = jeuService.recupererJeux(); // Ici récupererJeux récupère les jeux qui se trouve dans la //bdd.
        System.out.println("\n\n\n");
        //System.out.println(jeux);
        System.out.println("\n\n\n");
 
        return jeux;
    }
Voici ma méthode recupererJeux dans JeuServiceImpl :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
	@Override
	public List<Jeu> recupererJeux(){
		return jeuDao.findAll();
	}
Merci par avance pour votre aide.