First, a dataProvider should contain data.  It looks like you are
putting ui components in the dataProvider.  Unless you are working a
very extreme edge-case, you do not want to do that.  What are you trying
to accomplish?

 

Second, you cannot use creationComplete to show row/item level UI in a
renderer.  All display work in a renderer must happen as the result of
the framework's call to the set data() function.  Typically, one
overrides set data().

 

I think you may have some basic misconceptions to work through.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of y.mauron
Sent: Monday, June 02, 2008 4:04 AM
To: [email protected]
Subject: [flexcoders] First row trouble with datagrid component

 


topic summary : 
The first element of my dataprovider is not shown and there is always
an empty line as the first line of my datagrid

Dear all,

I think my question is entirely explained in the topic summary of this
post. I have a datagrid that uses a item renderer. The main app is
defined like in the first part of the attached code. The itemrenderer
looks like the second part of the attached code.

When I run it, the first item of my dataprovider is not shown while
the first line of my datagrid is always empty... Any idea to explain
this strange behavior ?

Thanks in advance...

Attach Code

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
layout="absolute" creationComplete="init()">

<mx:Script>
<![CDATA[
import mx.containers.VBox;
import mx.controls.Alert;
import mx.controls.Image;
import mx.collections.ArrayCollection;
public var essai2:ArrayCollection = new ArrayCollection();

public function init():void{
var img:Image = new Image();
img.source = "1.gif";
var box1:VBox = new VBox();
box1.addChild(img);
essai2.addItem(box1);
essai2.addItem(box1);
}


]]>
</mx:Script>

<mx:DataGrid x="10" y="10" id="dg" dataProvider="{essai2}"
width="100%" height="100%">
<mx:columns>

<mx:DataGridColumn itemRenderer="{new ClassFactory(relifeData)}">

</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>

</mx:Application>

__________________________________________________________

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
creationComplete="addComp()">

<mx:Script>
<![CDATA[
import mx.controls.Alert;

function addComp():void{

boxContainer.addChild(DisplayObject(data));

}
]]>
</mx:Script>


<mx:Box id="boxContainer">

</mx:Box>

</mx:Canvas>

 

Reply via email to