Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Flash/Flex > Flex
Flex Forum d'entraide sur la programmation Adobe Flex : applications Internet riches (RIA)
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 09/06/2008, 18h27   #1
Membre à l'essai
 
Inscription : mai 2005
Messages : 75
Détails du profil
Informations forums :
Inscription : mai 2005
Messages : 75
Points : 21
Points : 21
Par défaut Acceder au propriétés d'un itemRenderer

Salut,

voila je suis coincé, j'ai un TileList qui contient un composant à moi, j'arrive très bien à l'afficher en utilisant le tag <mx:itemRenderer> mais par contre j'ai besoin de faire des actions dessus, comme remplir des datagrids, cacher des labels...

Et j'ai beau passé du temps sur le net à la recherche d'info, je suis perdu

alors voila mon bout de code mxml :
Code :
1
2
3
4
5
6
7
8
9
10
<mx:TileList id="boxUnmatching" 
		rowHeight="{boxUnmatching.height/2-20}" columnWidth="{boxUnmatching.width-15}" 
		width="100%" height="100%" maxColumns="1"
		selectable="false" backgroundColor="#fafa5a">
	 	<mx:itemRenderer>
               <mx:Component>
                  		<views:Proposition/>
               	</mx:Component>
            </mx:itemRenderer>
	</mx:TileList>
et mon composant :

Code :
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
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" 
	xmlns:views="com.axway.osredi.flex.views.*"
	xmlns:controllers="com.axway.osredi.flex.controllers.*" 
	backgroundColor="#ffd5ff" width="100%" height="100%"
	creationComplete="{propositionController.initialize(this)}"
	borderStyle="inset"> 
 
	<controllers:PropositionController id="propositionController"/>	
 
	<mx:VBox id="contenant" height="100%" width="100%">
		<mx:HBox id="hb_1" width="100%" height="5%">
			<mx:CheckBox id="checkbox" width="30" height="100%"/>
			<mx:Label text="Proposition :" height="100%" fontWeight="bold" fontSize="11" width="91" paddingTop="13"/>
			<mx:Spacer height="100%" width="70%"/>
			<mx:VBox id="detailMatching" width="25%" height="100%" visible="false">				
				<mx:HBox id="detailLettrageOK" width="100%" height="50%">
					<mx:Label text="Lettré par : " fontWeight="bold"/>	
					<mx:Label id="userLettrage" fontWeight="bold"/>	
					<mx:Label text=" Le : " fontWeight="bold"/>	
					<mx:Label id="dateLettrage" fontWeight="bold"/>	
				</mx:HBox>
				<mx:HBox id="detailDelettrageOK" width="100%" height="50%" visible="false">
					<mx:Label text="Delettré par : " fontWeight="bold"/>	
					<mx:Label id="userDelettrage" fontWeight="bold"/>	
					<mx:Label text=" Le : " fontWeight="bold"/>	
					<mx:Label id="dateDelettrage" fontWeight="bold"/>	
				</mx:HBox>
			</mx:VBox>
		</mx:HBox>
		<mx:HDividedBox height="90%" width="100%">
			<mx:Panel id="panelFacture" width="50%" height="100%" title="Factures" textAlign="left">
				<mx:DataGrid id="dgFacture" width="100%" height="100%"  allowMultipleSelection="true" horizontalScrollPolicy="auto" dragMoveEnabled="true" dragEnabled="true" dropEnabled="false">
					<mx:columns>
						<mx:DataGridColumn/>
					</mx:columns>
				</mx:DataGrid>
			</mx:Panel>
			<mx:Panel id="panelRebut" width="50%" height="100%" title="Rebut" textAlign="left">
				<mx:DataGrid id="dgRebut" width="100%" height="100%"  allowMultipleSelection="true" horizontalScrollPolicy="auto" dragMoveEnabled="true" dragEnabled="true" dropEnabled="false">
					<mx:columns>
						<mx:DataGridColumn/>
					</mx:columns>
				</mx:DataGrid>
			</mx:Panel>
		</mx:HDividedBox>
		<mx:HBox width="100%" height="5%">
			<mx:Button id="duplicateLine" label="Dupliquer une ligne" enabled="true"/>
			<mx:Button id="deleteLine" label="Supprimer une ligne" enabled="true"/>
		</mx:HBox>
	</mx:VBox>
</mx:VBox>
En fait sur un evenement j'affiche ma tilelist, et je veux rempli les datagrid de mon composant

voila la function que je fait pour afficher mon tilelist :

Code :
1
2
3
4
5
6
7
8
9
		public function getMatchingsResult(matchingList:ArrayCollection):void{
 
			for each (var matching:Matching in matchingList){
				var newProp:Proposition= new Proposition();
				propArray.addItem(newProp as Proposition); 
 
				//displayMatching(matching);
			}
			delettrage.boxUnmatching.dataProvider=propArray as ArrayCollection;
Et en fait je souhaiterai juste faire un truc du style newProp.checkbox.visible=false
Mais je ne peux pas j'ai un nul pointer exception

Alors si qq un pouvait me donner une piste parce que la je craque

Merci beaucoup
lanfeustdetroll est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/06/2008, 16h55   #2
Membre habitué
 
Avatar de Watier_53
 
Étudiant
Inscription : novembre 2007
Messages : 469
Détails du profil
Informations personnelles :
Âge : 27
Localisation : France, Maine et Loire (Pays de la Loire)

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : novembre 2007
Messages : 469
Points : 107
Points : 107
tu ne peux pas agir sur les composants même de tes items de ta liste. Le sul moyen que tu as c'est de passer par le data provider de tal liste qui lui va lirer tes composants et les objets de ton data provider

Sinon pour la moindre action sur tes composants il faut que tu fasses cela dans ton composant même

pour lier le data provider et les objets tu utilises le data

par exemple un label de ton item tu fais
Code :
1
2
 
<mx:Label text="{data.prenom}"/>
et dans ton dataProvider tu passes un object
Code :
1
2
3
 
var o:Object = {prenom:"john"};
list.dataProvider.addItem(o);
Watier_53 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/06/2008, 11h52   #3
Membre habitué
 
Avatar de greatalain
 
Homme Alain Great
Développeur informatique
Inscription : novembre 2007
Messages : 124
Détails du profil
Informations personnelles :
Nom : Homme Alain Great
Localisation : France

Informations professionnelles :
Activité : Développeur informatique
Secteur : Communication - Médias

Informations forums :
Inscription : novembre 2007
Messages : 124
Points : 146
Points : 146
mets un id à ton composant
Code :
1
2
3
4
5
6
7
8
9
10
11
 
<mx:TileList id="boxUnmatching" 
		rowHeight="{boxUnmatching.height/2-20}" columnWidth="{boxUnmatching.width-15}" 
		width="100%" height="100%" maxColumns="1"
		selectable="false" backgroundColor="#fafa5a">
	 	<mx:itemRenderer>
               <mx:Component>
                  		<views:Proposition id="monComposant/>
               	</mx:Component>
            </mx:itemRenderer>
	</mx:TileList>
et dans la partie script si tu fait monComposant.checkBox.visible = false, par exemple ca marchera

ou alors je comprends pas ta demande
greatalain est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/06/2008, 14h27   #4
Membre du Club
 
Inscription : mars 2007
Messages : 36
Détails du profil
Informations personnelles :
Localisation : France, Paris (Île de France)

Informations forums :
Inscription : mars 2007
Messages : 36
Points : 40
Points : 40
Non alain, Watier_53 a raison, il n'est pas possible d'accéder directement au composant.
Sthocs est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 02h29.


 
 
 
 
Partenaires

Hébergement Web