数据网格中的编号行
我正在创建一个应用程序,用户将其投资信息输入到每行的数据网格中,一次一行。当他们移动时,会动态生成新行,以便他们可以输入新的投资。当用户移动并输入新信息时,我想要一列来显示用户所在的行(或者更好地说明他所在的投资数量)。我对如何创建该函数有一个想法:
private function rowCount():void
{
myDG.dataProvider=tasks;
myDG.rowCount=tasks.length;
}
但我只是不确定如何在数据网格中实现它。
我将如何实现这样的事情?我将使用什么数据网格属性?我对 Flex 3 还很陌生,所以非常感谢您的帮助!
<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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简单来说,您需要在 itemRenderer 中显示该行的索引。
看看这个问题和答案,问题及其解决方案是相同的(因为
List
和DataGrid
派生自相同的ListBase
):Flex3 中的显示列表 ItemRenderer 索引
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
andDataGrid
derives from the sameListBase
):Display List ItemRenderer Index in Flex3