Mag 16
L’esempio vale più di mille spiegazioni:
import mx.collections.ArrayCollection; import mx.utils.StringUtil; private static const DP_LENGTH:int = 100; private static const VISIBLE_ROWS_COUNT:int = 20; [Bindable] private var currentPage:int = 0; [Bindable] private var dataProvider:ArrayCollection; protected function init():void { var dpArray:Array = []; for (var i:int = 0; i < DP_LENGTH; i++) { var item:Object = { first: i, second: Math.random(), third: Math.random() }; dpArray.push(item); } dataProvider = new ArrayCollection(dpArray); dataProvider.filterFunction = pagingFilterFunction; dataProvider.refresh(); } protected function nextPage():void { currentPage++; dataProvider.refresh(); } protected function prevPage():void { currentPage--; dataProvider.refresh(); } private function pagingFilterFunction(item:Object):Boolean { var start:int = currentPage * VISIBLE_ROWS_COUNT; var end:int = start + VISIBLE_ROWS_COUNT - 1; var index:int = dataProvider.getItemIndex(item); return (index >= start) && (index <= end); }
Interessante articolo Adobe Flex DataGrid with 4 million rows. Demo
Ultimi Commenti