0

I am creating an app where users input their investment info into a datagrid on each row one row at a time. As they move along new rows are dynamically generated so they can input new investments. As the user moves and puts in new info I want a column to display what row the user is on (or better said what number investment he is on). I had an idea about the how to create the function:

private function rowCount():void
      {
        myDG.dataProvider=tasks;
        myDG.rowCount=tasks.length;
        }

but Im just not sure how to implement it in the datagrid.

How would I implement something like that? What datagrid property would I use? Im still fairly new to flex 3 so any help is appreciated!

<mx:DataGrid id="myDG"

 width="908" height="410" 
dataProvider="{tasks}" 
sortableColumns="false" editable="true"
itemEditBeginning="checkEdit(event)" 

itemEditEnd="editEnd(event)" x="10" y="0" >
<mx:columns>
  <mx:DataGridColumn headerText="Investment number" 
    dataField="investment number "  width="80">

  <mx:DataGridColumn headerText="Symbol" 
    dataField="symbol"  width="105">
    </mx:DataGridColumn>
   <mx:DataGridColumn headerText="Trade Date" 
    dataField="date"  width="80">

</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
Louie
  • 13
  • 2

1 Answers1

1

Putting simply, you need to display the index of the row in itemRenderer.

Look at this question and answers, the problem and its solution are the same (since List and DataGrid derives from the same ListBase):

Display List ItemRenderer Index in Flex3

Community
  • 1
  • 1
moropus
  • 3,672
  • 1
  • 22
  • 30