这两天看了一下ItemRenderer, 看到DataGridListData里有个rowIndex属性,结果在用的时候,发现它并不是我所想像的index,看了文档后才知道,这只是可见行中的rowIndex,如果要知道某行所在DataGrid中的行数,需要用到verticalScrollPosition,也就是这样的代码:
//This renderer is a TextArea Component
override public function set data(value:Object):void{
text = (DataGridListData(listData).rowIndex + DataGrid( DataGridListData(listData).owner).verticalScrollPosition);
}
本文详细介绍了在使用ItemRenderer时如何正确获取DataGrid中某行的实际位置。通过对比rowIndex与verticalScrollPosition的区别,指出仅依靠rowIndex无法得到准确的行数,必须结合使用verticalScrollPosition来确定具体行数。
3638

被折叠的 条评论
为什么被折叠?



