Flex中怎样把焦点固定在DataGrid的特定一行上
项目中DataGrid的dataProvider是动态更新的。点击DataGrid的一行,这行获得焦点,但是当dataProvider的数据更新之后,这个焦点就消失了。怎...
项目中DataGrid的dataProvider是动态更新的。点击DataGrid的一行,这行获得焦点,但是当dataProvider的数据更新之后,这个焦点就消失了。怎样才能重新把焦点定到刚才的那一行上?谢谢指点,感激不尽~~
展开
1个回答
展开全部
使用scrollToIndex()
public function scrollToIndex(index:int):Boolean
Ensures that the data provider item at the given index is visible. If the item is visible, the verticalScrollPosition property is left unchanged even if the item is not the first visible item. If the item is not currently visible, the verticalScrollPosition property is changed make the item the first visible item, unless there aren't enough rows to do so because the verticalScrollPosition value is limited by the maxVerticalScrollPosition property.
Parameters
index:int — The index of the item in the data provider.
Returns
Boolean — true if verticalScrollPosition changed.
参见手册: http://livedocs.adobe.com/flex/3/langref/mx/controls/listClasses/ListBase.html#scrollToIndex()
public function scrollToIndex(index:int):Boolean
Ensures that the data provider item at the given index is visible. If the item is visible, the verticalScrollPosition property is left unchanged even if the item is not the first visible item. If the item is not currently visible, the verticalScrollPosition property is changed make the item the first visible item, unless there aren't enough rows to do so because the verticalScrollPosition value is limited by the maxVerticalScrollPosition property.
Parameters
index:int — The index of the item in the data provider.
Returns
Boolean — true if verticalScrollPosition changed.
参见手册: http://livedocs.adobe.com/flex/3/langref/mx/controls/listClasses/ListBase.html#scrollToIndex()
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询