Bonjour,
Je souhaite mettre en place l'alimentation d'un composant Grid via un flux xml généré par un programme php. Ci-après mes différents élements
1 - programme php
2 - code 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
31 <?php header ('Content-Type:text/xml; charset=ISO-8859-1'); ?> <?xml version="1.0" encoding="utf-8"?> <ListProducts> <Request> <IsValid>True</IsValid> <ItemSearchRequest> <Author>nom_01</Author> <SearchIndex>Products_01</SearchIndex> </ItemSearchRequest> <TotalResults><?php echo($adminProductsList->getTotalNumberOcc()); ?></TotalResults> <TotalPages><?php echo($adminProductsList->getNumberPage()); ?></TotalPages> </Request> <Products> <?php $loop = 0; while ( $loop < $adminProductsList->getNumberOccurrence()) { $occ = $adminProductsList->getOccurrence($loop); ?> <Product Id='<?php echo($occ->getReferenceProduct()); ?>'> <Reference><?php echo($occ->getReferenceProduct()); ?></Reference> <Categorie><?php echo($occ->getCategorieProduct()); ?></Categorie> <Designation><?php echo($occ->getDesignationProduct()); ?></Designation> <Statut><?php echo($occ->getStatutProduct()); ?></Statut> </Product> <?php $loop = $loop + 1; } ?> </Products> </ListProducts>
Mais le grid n'est pas alimenté. En passant par firefox ou même sous l'outils de dev sous IE9, en regardant la partie "Reponse" de la requête, le flux xml est bien généré.
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
31
32
33
34
35
36
37 Ext.onReady(function(){ // create the Data Store var store = new Ext.data.Store({ // load using HTTP proxy : new Ext.data.HttpProxy({ url: './indexAdmin.php?uri=AdminProductsList&acte=begin' }), // the return will be XML, so lets set up a reader reader: new Ext.data.XmlReader({ // records will have an "Item" tag record: 'Product', idProperty: '@id', totalRecords: '@total'}, [ {name: 'Id', mapping: '@id'}, 'Reference', 'Categorie', 'Designation', 'Statut' ]) }); // create the grid var grid = new Ext.grid.GridPanel({ store: store, columns: [ {header: "Reference", width: 120, dataIndex: 'Reference', sortable: true}, {header: "Categorie", width: 180, dataIndex: 'Categorie', sortable: true}, {header: "Designation", width: 115, dataIndex: 'Designation', sortable: false}, {header: "Statut", width: 100, dataIndex: 'Statut', sortable: false} ], renderTo:'example-grid', width:540, height:200 }); store.load(); });
Peut-être que le soucis est au niveau de mon code JS, mais je ne vois rien. Voyez-vous le soucis ?
D'avance merci pour votre aide.
A+
Stéphane.
Partager