> Is it possible to create GridRows and GridItems via Actionscript? 

Yes, you can see the following sample code.


> I have a Grid that I am using RowSpan and Colspan with the GridItem's. 
> I am curious if there is  any way to Create this Grid dynamically from 
> XML data? Or is there a way that i can achieve Colspan type formatting 
> in a DataGrid?

Grid from XML will not be generated automatically, but you can write your
logic to parse XML and add GridRow/GridItem as required. No, DataGrid
doesn't support ColSpan type formatting, but can it be achieved by writing
custom row renderer?



##DynamicGrid.mxml##
<mx:Application width="800" height="600"
xmlns:mx="http://www.macromedia.com/2003/mxml";
creationComplete="createGrid()">

    <mx:Script>
        <![CDATA[

        import mx.containers.Grid;
        import mx.containers.GridRow;
        import mx.containers.GridItem;
        import mx.controls.Button;
        
        function createGrid() 
        {
            
            var grid:Grid = Grid(this.createChild(Grid,""));
            grid.setStyle('borderStyle', "solid");
            
            var rowCount:Number = 5;
            var columnCount:Number = 3;
            
            for(var r=0;r<rowCount;r++) 
            {
                var gridRow:GridRow = GridRow(grid.createChild(GridRow,
""));
                for(var c=0;c<columnCount;c++)
                {
                    var gridItem:GridItem =
GridItem(gridRow.createChild(GridItem, ""));
                    gridItem.createChild(Button, "" , {label:'Button'});
                }
            }
        
        }

        ]]>
    </mx:Script>

</mx:Application>



-abdul

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Jae Hess
Sent: Saturday, May 21, 2005 2:59 AM
To: [email protected]
Subject: [flexcoders] Grid Creation from XML

Is it possible to create GridRows and GridItems via Actionscript?

I have a Grid that i am using RowSpan and Colspan with the GridItem's. 
I am curious if there is  any way to Create this Grid dynamically from 
XML data? Or is there a way that i can achieve Colspan type formatting 
in a DataGrid?

Thanks in Advance

-Jae



 
Yahoo! Groups Links



 




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to