当Datagrid数据多时会出现滚动条,设置selectedIndex位置后,滚动条并不能根据Datagrid选中行的位置进行偏移。
这时候可使用verticalScrollPosition属性
AS:
protected function btn_clickHandler(event:MouseEvent):void
{
dgComplaints.selectedIndex=int(txt.text);
dgComplaints.verticalScrollPosition=dgComplaints.selectedIndex;
}
MXML:
<s:TextInput />
</mx:columns>
</mx:DataGrid>
protected function btn_clickHandler(event:MouseEvent):void
{
dgComplaints.selectedIndex=int(txt.text);
dgComplaints.verticalScrollPosition=dgComplaints.selectedIndex;
}
MXML:
<s:TextInput />
</mx:columns>
</mx:DataGrid>