4 Replies Latest reply on Feb 17, 2009 7:58 PM by

    Looping through a DataGrid

    Arthur-Lockman
      I need to loop thorugh a data grid so that i can send the data one record at a time through a httpservice. I know this sounds easy, but that is only if it has a data provider. My grid has no data provider because it gets data dropped into it for an upload. I am dropping the data from a FileSystemDataGrid. so, how do i do it with no data provider? I could probably do it with a for() statement, but i don't know how to access the data. Remember, it has no data provider. Help me please!!!
        • 1. Re: Looping through a DataGrid
          batmitra
          hi
          can you explain it better, perhaps with some code?
          I never saw a datagrid working without a dataprovider, because o asume the it has to get data to display data or else it would be empty, but i can be wrong so explain it to me please.
          • 2. Re: Looping through a DataGrid
            Arthur-Lockman Level 1
            Well, initially the data grid has no data in it. You were right, it is empty. But, only until i drop data into it. So, this is the data grid:

            <mx:DataGrid id="filesDG0" editable="true" width="799.8" height="190.1" dropEnabled="true" dragEnabled="true" enabled="true" x="10" y="263" toolTip="Drag files here to upload them">
            <mx:columns>
            <mx:DataGridColumn id="fileType" dataField="type" headerText="Type" visible="false" editable="false"/>
            <mx:DataGridColumn id="fileName" headerText="Your Image Name" editable="true" />
            <mx:DataGridColumn id="origFileName" headerText="File Name" dataField="name" editable="false" />
            <mx:DataGridColumn dataField="url" headerText="Url" visible="false" editable="false"/>
            <mx:DataGridColumn dataField="size" headerText="Size" editable="false"/>
            <mx:DataGridColumn dataField="url" headerText="Prewiew" editable="false" >
            <mx:itemRenderer>
            <mx:Component>
            <mx:Image source="url" width="50" height="50" />
            </mx:Component>
            </mx:itemRenderer>
            </mx:DataGridColumn>
            </mx:columns>
            </mx:DataGrid>
            So, all i do is drop into it from a file system grid (AIR). that's all the explaining I can do because that is all there is to it.
            • 3. Re: Looping through a DataGrid
              Level 7

              "arthurlockman" <webforumsuser@macromedia.com> wrote in message
              news:g7uebk$192$1@forums.macromedia.com...
              > Well, initially the data grid has no data in it. You were right, it is
              > empty.
              > But, only until i drop data into it. So, this is the data grid:
              >
              > <mx:DataGrid id="filesDG0" editable="true" width="799.8" height="190.1"
              > dropEnabled="true" dragEnabled="true" enabled="true" x="10" y="263"
              > toolTip="Drag files here to upload them">
              > <mx:columns>
              > <mx:DataGridColumn id="fileType" dataField="type" headerText="Type"
              > visible="false" editable="false"/>
              > <mx:DataGridColumn id="fileName" headerText="Your Image Name"
              > editable="true" />
              > <mx:DataGridColumn id="origFileName" headerText="File Name"
              > dataField="name" editable="false" />
              > <mx:DataGridColumn dataField="url" headerText="Url" visible="false"
              > editable="false"/>
              > <mx:DataGridColumn dataField="size" headerText="Size"
              > editable="false"/>
              > <mx:DataGridColumn dataField="url" headerText="Prewiew"
              > editable="false" >
              > <mx:itemRenderer>
              > <mx:Component>
              > <mx:Image source="url" width="50" height="50" />
              > </mx:Component>
              > </mx:itemRenderer>
              > </mx:DataGridColumn>
              > </mx:columns>
              > </mx:DataGrid>
              > So, all i do is drop into it from a file system grid (AIR). that's all the
              > explaining I can do because that is all there is to it.

              What happens if you put in a break point and look at the value of
              dataprovider once there is some information in your dg?


              • 4. Re: Looping through a DataGrid
                anyone know how to make loop here..
                i'm new in flex.. this is the code..

                var stringToSplit:String = myText.text
                var result:Array = stringToSplit.split(" ");
                var Split:LogReader = new LogReader();
                Split.ip = result[0];
                Split.date = result[3] + result[4];
                Split.method = result[5];
                Split.info = result[6] + result[7];
                Split.status = result[8];
                sourceArray.push(Split);
                dp.refresh();