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";
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";
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