Salut,
J'ai un fichier XML de la form :
et j'ai 2 DataGrid, la première contiendra les 4 premières info générals (<MsgName> <MsgStatus> <NbMisTag> <NbFormatErr>) de chaque message (<MSG>), puis je veux fair un Drag'n'Drop pour un message séléctionné de la 1er DtaGrid vers la 2eme DataGrid pour qu'il s'affiche les infos corespondant à chaque (<TAG>) du message selectionné
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
38
39
40
41 <?xml version="1.0"?> <MSGS> <MSG> <MsgName>Message1</MsgName> <MsgStatus>KO</MsgStatus> <NbMisTag>1</NbMisTag> <NbFormatErr>1</NbFormatErr> <TAG> <NAME>toto</NAME> <VALUE>blabla</VALUE> <ERROR>VALID_TAG</ERROR> </TAG> <TAG> <NAME>tata</NAME> <VALUE></VALUE> <ERROR>MISSING_TAG</ERROR> </TAG> <TAG> <NAME>titi</NAME> <VALUE>blibli</VALUE> <ERROR>INVALID_TAG</ERROR> </TAG> </MSG> <MSG> <MsgName>Msessage2</MsgName> <MsgStatus>OK</MsgStatus> <NbMisTag>0</NbMisTag> <NbFormatErr>0</NbFormatErr> <TAG> <NAME>TAG1</NAME> <VALUE>Amo</VALUE> <ERROR>VALID_TAG</ERROR> </TAG> <TAG> <NAME>TAG2</NAME> <VALUE>Said</VALUE> <ERROR>VALID_TAG</ERROR> </TAG> </MSG> </MSGS>
voici le code AS et MXML pour le momo :
Quelle function AS je doit ajouter pour que "tags" contiendra un "ArrayCollection" des tags du message (ou l'objet) selectionné par le drag&drop
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:view="view.*" width="1160" height="560"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; [Bindable] private var msgs:ArrayCollection [Bindable] private var tags:ArrayCollection private function getMsgs(e:ResultEvent):void{ msgs=e.result.MSGS.MSG; } ]]> </mx:Script> <mx:HTTPService id="xmlFetch" result="getMsgs(event)" url="http://localhost:8080/Workspace/All_Msgs.xml"/> <mx:Panel id="windowA" x="312" y="52" width="250" height="200" layout="absolute" title="Fenetre A" creationComplete="xmlFetch.send()"> <mx:DataGrid id="MsgGrid" width="100%" height="100%" dataProvider="{msgs}" dragEnabled="true"> <mx:columns> <mx:DataGridColumn headerText="Message" dataField="MsgName"/> <mx:DataGridColumn headerText="Status" dataField="MsgStatus"/> <mx:DataGridColumn headerText="Missing Tag" dataField="NbMisTag"/> <mx:DataGridColumn headerText="Invalid Format" dataField="NbFormatErr"/> </mx:columns> </mx:DataGrid> </mx:Panel> <mx:Panel id="windowB" x="598" y="52" width="250" height="200" layout="absolute" title="Fenetre B"> <mx:DataGrid id="TagGrid" width="100%" height="100%" dataProvider="{tags}" dropEnabled="true"> <mx:columns> <mx:DataGridColumn headerText="Tag" dataField="NAME"/> <mx:DataGridColumn headerText="Value" dataField="VALUE"/> <mx:DataGridColumn headerText="Notification" dataField="ERROR"/> </mx:columns> </mx:DataGrid> </mx:Panel> </mx:Canvas>
Aidez moi SVP !
Partager