用例页面代码:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application initialize="oninit()" xmlns:mx="http://www.adobe.com/2006/mxml " layout="vertical" xmlns:ns1="Units.*" xmlns:ns2="*">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import flash.events.Event;
import Units.*;
private var datas:Array = new Array();
function oninit():void
{
for(var i:int=0;i<1110;i++)
{
datas.push({UserName:"Henry"+i,Notes:" GuangZhou " +i})
}
pagebar1.RecordCount =datas.length;
pagebar1.Open();
}
function pagechange(e:PageChangeEvent):void
{
datalist.dataProvider = e.Filter(datas)
}
]]>
</mx:Script>
<mx:DataGrid width="100%" id="datalist">
<mx:columns>
<mx:DataGridColumn headerText="UserName" dataField="UserName"/>
<mx:DataGridColumn headerText="Notes" dataField="Notes"/>
</mx:columns>
</mx:DataGrid>
<ns2:PageBar id="pagebar1" PageChange="pagechange(event)">
</ns2:PageBar>
</mx:Application>
<mx:Application initialize="oninit()" xmlns:mx="http://www.adobe.com/2006/mxml " layout="vertical" xmlns:ns1="Units.*" xmlns:ns2="*">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import flash.events.Event;
import Units.*;
private var datas:Array = new Array();
function oninit():void
{
for(var i:int=0;i<1110;i++)
{
datas.push({UserName:"Henry"+i,Notes:" GuangZhou " +i})
}
pagebar1.RecordCount =datas.length;
pagebar1.Open();
}
function pagechange(e:PageChangeEvent):void
{
datalist.dataProvider = e.Filter(datas)
}
]]>
</mx:Script>
<mx:DataGrid width="100%" id="datalist">
<mx:columns>
<mx:DataGridColumn headerText="UserName" dataField="UserName"/>
<mx:DataGridColumn headerText="Notes" dataField="Notes"/>
</mx:columns>
</mx:DataGrid>
<ns2:PageBar id="pagebar1" PageChange="pagechange(event)">
</ns2:PageBar>
</mx:Application>