1 Reply Latest reply on Jan 4, 2011 10:14 AM by Flex harUI

    how to scrolling to a specific index in a Flex datagride control?


      i have a ac arrayCollection and when my app call init(), i want a partNo:11192 become a frist row but my init() function does not work the grid.scrollToIndex(0) does not let partNo:11192 become the first row,how to do this? can somebody give me a example? thank for helping

      [Bindable] public var ac:ArrayCollection = new ArrayCollection([ {item:"A", partNo:"96001-06045", desc:"machine-1",qty:"1",remarks:"test1"}, {item:"B", partNo:"11192", desc:"machine-2",qty:"2",remarks:"test2"}, {item:"C", partNo:"11102", desc:"machine-3",qty:"5",remarks:"test3"}]); private function init() {   sortField = new SortField("partNo")   sort = new Sort()   sort.fields = [ sortField ]   ac.sort = sort   ac.refresh()   cursor =ac.createCursor()   cursor.findFirst( { partNo:"11192"} )   var idx:int=0;   grid.selectedIndex=1;   grid.validateNow();   grid.scrollToIndex(0); }