bonjour,
je voudrais alimenter une combobox dans un datagrid à partir d'une fonction php.
dans mon mxml j'ai donc mon remoteobject
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 <mx:RemoteObject id="CountryService" fault="faultHandler(event)" showBusyCursor="true" source="Country" destination="amfphp"> <mx:method name="getCountryList" result="resultCountryList(event)" fault="faultHandler(event)"/> </mx:RemoteObject>
et mon datagrid :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 <mx:DataGrid id="dataGrid" dataProvider="{dataArr}" rowCount="8" editable="true" resizableColumns="true" headerRelease="setOrder(event);" width="520" height="328" x="22.5" y="10"> <mx:columns> <mx:DataGridColumn headerText="Zip code" dataField="cty_idCol" /> <mx:DataGridColumn headerText="City name" dataField="cty_nameCol" /> <mx:DataGridColumn headerText="Country" dataField="cty_cnt_idCol"/> </mx:columns> </mx:DataGrid>
dans mon actionscript j'ai :
et ma fonction php :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 //Country list result private function resultCountryList (evt:ResultEvent):void { cty_cnt_idCol.dataProvider = evt.result; }
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 <?php require_once("C:\Program Files\EasyPHP 2.0b1\www\divecenter\DiveCenterconn.php"); class Country { //Class constructor function Country() { } //Country list from database function GetCountryList() { $Query = 'select cnt_id as data,cnt_name as label from country'; $Result = mysql_query( $Query ); while ($row = mysql_fetch_object($Result)) { $Array[] = $row; } return( $Array ); } } ?>
donc comment indiquer dans mon datagrid que je veux afficher le résultat de ma fonction php dans le champ "country" sous forme de combobox ?
je suis un super novice en flex donc peut etre que je ne suis pas très clair....
en tous cas, je vous remercie par avance pour votre aide.
merci
yudawei






Répondre avec citation
Partager