0 0

Flex datagrid带有分页功能,如果获取不同页的选中项?5

datagrid带有分页功能,如果获取不同页的选中项?
2013年9月11日 11:14

2个答案 按时间排序 按投票排序

0 0

给你一个案例吧~~

	[Bindable]
           public var pageSize:int;//每页显示行数
			
			[Bindable]
           private var currentPage:int;//当前页
           
           	[Bindable]
           public var totalRecord:int=0;//总记录数
   			
   			[Bindable]
           private var totalPage:int=0;//总页数
   			
           [Bindable]
           public var currData:Array;//列表数据
			
           [Bindable]
           public var arrColumns:Array;//DataGrid列,在调用时需要为这个数组设置数据

 //分页数据加载
           private function loadData(pageNum:int):void{
           		if(this.ite!=null){
           			ite._data.cloumnSelected = false;
           			this.dataGrid.arrColl.removeAll();
           		}
           		
           		this.param.currPage = pageNum; //跳转页码
           		this.param.pageSize = this.pageSize; //页显示数量
           		HessianServiceInvoker.getInstance().invoke(this.serviceName, this.methodName, this.param, callBackHandler);
           }
           
           //回调
           private function callBackHandler(event:HessianResultEvent):void{
           		
           		var page:Object = event.result as Object;
           		init(page, this.serviceName, this.methodName, this.param);
           }
           	//刷新当前datagrid
	        public function refleshGrid():void{
	           		
	           	this.param.currPage = this.currentPage; //跳转页码
	           	this.param.pageSize = this.pageSize; //页显示数量
	           	HessianServiceInvoker.getInstance().invoke(this.serviceName, this.methodName, this.param, callBackHandler);
	        }


<mx:VBox width="100%" height="100%" verticalGap="0" horizontalAlign="center" backgroundColor="white">

       <ui:MyDataGrid id="dataGrid" width="100%"  height="100%" rowHeight="30" editable="false" dataProvider="{currData}" columns="{arrColumns}" styleName="myGrid"/>
       <mx:HBox backgroundColor="#f3fafe" cornerRadius="0" borderStyle="solid" borderSides="[top]" horizontalAlign="right" verticalAlign="middle" width="100%" >
            <mx:Text text="{'  第'+(totalPage>0?(currentPage):0)+'页/共'+totalPage+'页'+'  共'+totalRecord+'条记录'}"/>
           <mx:LinkButton id="lbtnFirst" label="首页" color="#059405" click="loadData(1)" enabled="{lbtnPrevious.enabled}"/>
           <mx:LinkButton id="lbtnPrevious" label="上一页" color="#059405" click="loadData(currentPage - 1)" enabled="{currentPage>1?true:false}"/>
           <mx:LinkButton id="lbtnNext" label="下一页" color="#059405" click="loadData(currentPage + 1);" enabled="{totalPage>currentPage?true:false}"/>
           <mx:LinkButton id="lbtnLast" label="尾页" color="#059405" click="loadData(totalPage);" enabled="{lbtnNext.enabled}"/>
           <mx:NumericStepper id="nsPageNum" stepSize="1" minimum="1" maximum="{totalPage}" enabled="{lbtnJump.enabled}" cornerRadius="0"/>
           <mx:LinkButton id="lbtnJump" label="跳转" color="#059405" click="loadData(nsPageNum.value);" enabled="{totalPage>1?true:false}"/>
       </mx:HBox>

    </mx:VBox>

2013年9月12日 15:04
0 0

在as脚本中声明一个ArrayCollection,选中grid的某条列表时添加到Arraycollection中,翻页后选中添加,需要的时候从里面取出来就可以了

2013年9月11日 16:25

相关推荐

Global site tag (gtag.js) - Google Analytics