Hi Saurabh,

You can do it with Repeater like this...

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="vertical">
    <mx:Script>
        <![CDATA[
            import com.adobe.utils.ArrayUtil;
            import mx.controls.dataGridClasses.DataGridColumn;
            import mx.controls.DataGrid;

            [Bindable] private var arr:Array = [0,1,2,3];

            private function gen():void{
                arr = new Array;
                var noOfGrids:int = int(gridNos.text);
                for (var i:int=0; i<noOfGrids; i++)
                {
                    arr.push(i);
                }
                reps.executeBindings();
            }
        ]]>
    </mx:Script>
    <mx:XMLList id="employees">
        <employee>
            <name>Christina Coenraets</name>
            <phone>555-219-2270</phone>
            <email>[email protected]</email>
            <active>true</active>
        </employee>
        <employee>
            <name>Joanne Wall</name>
            <phone>555-219-2012</phone>
            <email>[email protected]</email>
            <active>true</active>
        </employee>
        <employee>
            <name>Maurice Smith</name>
            <phone>555-219-2012</phone>
            <email>[email protected]</email>
            <active>false</active>
        </employee>
        <employee>
            <name>Mary Jones</name>
            <phone>555-219-2000</phone>
            <email>[email protected]</email>
            <active>true</active>
        </employee>
    </mx:XMLList>
    <mx:HBox>
        <mx:TextInput id="gridNos" restrict="0-9" maxChars="2"/>
        <mx:Button label="Generate" click="gen()"/>
    </mx:HBox>

    <mx:HBox width="100%" id="dgHolder">
          <mx:Repeater id="reps" dataProvider="{arr}"
recycleChildren="true">
            <mx:DataGrid id="dg" width="100%" height="100%" rowCount="5"
dataProvider="{employees}">
                <mx:columns>
                    <mx:DataGridColumn dataField="name" headerText="Name"/>
                    <mx:DataGridColumn dataField="phone"
headerText="Phone"/>
                    <mx:DataGridColumn dataField="email"
headerText="Email"/>
                </mx:columns>
            </mx:DataGrid>
        </mx:Repeater>
    </mx:HBox>
</mx:Application>


Regards,
Venkat
www.venkatv.com


On Tue, Mar 3, 2009 at 8:03 PM, cool saurabh
<[email protected]>wrote:

> hi all,
>
> Can anyone help me know how i can generate dynamic components eg: based on
> users input if user chooses 1 then 1 datagrid will be displayed & total
> width of datagrid is same as that of page. Now if user selects 3 then 3
> datgrids have to be displayed ;the given page width is divided into 3 parts
> then. Can anyone let me know how i can go for it(note: i am in need of
> seperate components eg 3 datagrids seperately & not datagrid with 3
> columns).
> Please help me to fix the problem i am unable to fix it out.
>
> Regards
> Saurabh
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to