Bonjour

Je souhaiterai afficher dans un AdvancedDataGridColumn du texte en HTML.
Voici mon code (épuré) :

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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="766" height="305">
 
	<mx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			import mx.collections.CursorBookmark;
			import mx.collections.HierarchicalData;
			import mx.collections.ICollectionView;
			import mx.collections.IHierarchicalCollectionView;
			import mx.collections.IHierarchicalCollectionViewCursor;
			import mx.collections.IViewCursor;
			import mx.controls.Alert;
			import mx.events.ListEvent;
 
			import sada.flex.components.RechercheRenderer;
 
			[Bindable]
			[Embed(source="assets/client.gif")]
			public var clientIcon : Class;
 
			[Bindable]
			[Embed(source="assets/contrat.gif")]
			public var contratIcon : Class;
 
			[Bindable]
			[Embed(source="assets/sinistre.gif")]
			public var sinsitreIcon : Class;
 
			[Bindable]
			private var dpFlat : ArrayCollection = new ArrayCollection([
				{client:"Client <b>Paul</b>",
					contrat:"Contrat monC<b>o</b>ntrat",
					sinistre:"<b>Pas</b> de sinistre",
					idClient:111, idCt:412000, idSi : -1, isAffich : 0},
				{client:"Client <b>Paul</b>",
					contrat:"Contrat 000",
					sinistre:"Sinistre <b>test</b>",
					idClient:111, idCt:413000, idSi : 33000, isAffich : 1},
				{client:"Client <b>Paul</b>",
					contrat:"Contrat 3",
					sinistre:"Pas de sinistre",
					idClient:111, idCt:415000, idSi : -1, isAffich : 0},
				{client:"Client Arnaud",
					contrat:"Contrat <b>55</b>",
					sinistre:"Sinistre 28",
					idClient:222, idCt:414000, idSi : 34000, isAffich : 1},
				{client:"Client Arnaud",
					contrat:"Contrat <b>55</b>",
					sinistre:"Sinistre 29",
					idClient:222, idCt:414000, idSi : 35000, isAffich : 0}
			]);
 
			/** Permet de retourner les infos du client (au lieu de l'idClient) */
			private function gfClient(item : Object, field : GroupingField) : String {
				return (String)(item.client);
			}
 
			/** Permet de retourner les infos du contrat (au lieu de l'idCt) */
			private function gfContrat(item : Object, field : GroupingField) : String {
				return (String)(item.contrat);
			}
 
			/** Permet de modifier le libellé du bouton et connaître sur quelle ligne on a double cliqué
			 * @param nbClick : correspond au nombre de click (simple ou double)*/
			private function doClick(nbClick : int) : void { 
				var item : Object = myADG.selectedItem;
				if (!item) { 
					return ;
				}
				...
				...
			}
 
			/** Permet d'ouvrir les listes comme souhaitée */
			private function doOpenNode() : void {
				var dataCursor : IHierarchicalCollectionViewCursor = myADG.dataProvider.createCursor();
				while (dataCursor.current != null) {
					if (dataCursor.currentDepth <= 1 ||
						(dataCursor.currentDepth == 2 && dataCursor.current.children[0].isAffich == 1)) {
						myADG.dataProvider.openNode(dataCursor.current);
					}
					else {
						myADG.dataProvider.closeNode(dataCursor.current);
					}
					dataCursor.moveNext();
				}
				myADG.dataProvider.refresh();
			}
 
			/** Icêne des noeuds */
			private function myGroupIconFunc(item : Object, depth : int) : Class {
				if (depth == 1){
					return clientIcon;
				}
				else if (depth == 2){
					return contratIcon;
				}
				else{
					return null;
				}
			}
 
			/** Icêne des feuilles */
			private function myIconFunc(item : Object) : Class {
				return sinsitreIcon;
			}
		]]>
	</mx:Script>
 
	<mx:AdvancedDataGrid id="myADG" width="599" height="305" y="0" initialize="gc.refresh()"
						 click="doClick(1)" keyUp="doClick(1)"
						 doubleClickEnabled="true" doubleClick="doClick(2)"
						 groupIconFunction="myGroupIconFunc"
						 iconFunction="myIconFunc">
 
		<mx:dataProvider>
			<mx:GroupingCollection id="gc" source="{dpFlat}">
				<mx:grouping>
					<mx:Grouping>
						<mx:GroupingField name="idClient" groupingFunction="gfClient"/>
						<mx:GroupingField name="idCt" groupingFunction="gfContrat"/>
					</mx:Grouping>
				</mx:grouping>
			</mx:GroupingCollection>
		</mx:dataProvider>
 
		<mx:columns>
			<mx:AdvancedDataGridColumn headerText="Retours de votre recherche" dataField="sinistre" id="sinADG"/>
		</mx:columns>
 
		<mx:rendererProviders>
			<mx:AdvancedDataGridRendererProvider column="{sinADG}" renderer="sada.flex.components.RechercheRenderer"/>
		</mx:rendererProviders>
 
	</mx:AdvancedDataGrid>
 
	<mx:Button x="645" y="58" label="Open node" click="doOpenNode()"/>
 
</mx:Canvas>
Mon renderer spécifique (avec du padding pour simuler le décalage... mais c'est assez moisi...) :
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
<?xml version="1.0"?>
<mx:Label xmlns:mx="http://www.adobe.com/2006/mxml" selectable="true">
	<mx:Script>
		<![CDATA[
			override public function set data(value : Object) : void{
				if (value.GroupLabel) {
					this.htmlText = value.GroupLabel;
					if ((String)(value.GroupLabel).substr(0, 6) == "Client") {
						this.setStyle("paddingLeft", "0");
					}
					else {
						this.setStyle("paddingLeft", "18");
					}
				}
				else {
					this.htmlText = value.sinistre;
					this.setStyle("paddingLeft", "36");
				}
			}
		]]>
	</mx:Script>
 
</mx:Label>
En faisant de cette manière, voici mes problèmes :
1. je perds le petit triangle permettant d'ouvrir et de fermer les noeuds
2. je perds les icônes (malgré groupIconFunction et iconFunction)
3. le curseur n'est pas une flèche mais un trait droit (comme pour sélectionner du texte)

Bref, comment écrire du texte en HTML dans un AdvancedDataGrid sans perdre le triangle ni les icônes (je veux juste écrire en gras quelques caractères)....

Des idées svp ?!? J'en ai vraiment besoin...

Merci !!!