Je charge un magasin de données dojo.store.JsonRestStore pour les presenter ensuite dans une grille (dojox.data.Grid) pour ça je passe par une structure intermediare le dojo.data.ObjectStore
Code javascript : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 var store = new dojo.store.JsonRest({target:"/users"}); var dataStore = new dojo.data.ObjectStore({objectStore: store});
Ensuite j'ai tésté la maniere en-script :
Code javscript : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 var grid = new dojox.grid.DataGrid({ store: dataStore, structure: [ {name: "Prenom", field: "prenom", width:"200px"}, {name: "Nom", field: "nom", width:"200px"}, {name:"Pôle", field: "pole", width:"200px"}, {name:"Numero", field: "numero", width:"200px"}, {name:"Adresse", field: "adresse", width:"200px"}, {name:"Etudes", field: "niveau", width:"200px"} ]}, "grid"); grid.startup(); });
Aucun problème tout marche bien. Mais quand j'essaie de le faire directement avec des balises
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 <table id="grid" jsId="grid" dojoType="dojox.grid.DataGrid" store="dataStore" query="{id: '*'}" clientSort="true" style="width: 100%; height: 100%;" rowSelector="20px"> <thead> <th field="prenom" width="200px"> Prenom </th> <th field="nom" width="200px"> Nom </th> <th field="pole" width="150px"> Pôle </th> <th field="numero" width="200px"> Numero </th> <th field="adresse" width="200px"> Adresse </th> <th field="niveau" width="200px"> Etudes </th> </thead> <script type="dojo/connect"> this.startup(); </script> </table>
Ca ne marche pas je pense que c'est un problème au niveau du script dans la table grid pour simuler le startup. Je n'arrive pas trouver l'evenement correspondant (j'ai essayé onAfterLoad, afterLoad, onFinishLoad).
Partager