header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
krishna
Points:260
Posts:0

5/7/2010 12:07:23 AM

Title: datagrid paging


Hi,

Please provide the example for this datagrid paging



1
NileshPawar
Points: 280
Posts:0
5/7/2010 12:14:02 AM



package
{
import mx.collections.ArrayCollection;
import mx.controls.Alert;

public class PagableArrayCollection extends ArrayCollection
{
public function PagableArrayCollection(source:Array=null){
super();
this.source = source;
pages=0;
}
//Private variables
private var _pages:Number;
private var _itemsPerPage:Number= 10;
private var _currentPage:Number = 1;
private var _maxIndex:Number = 10;
private var _minIndex:Number = 0;

//private methods
private function set pages(value:Number):void{
if(this.source.length % this.itemsPerPage == 0){
_pages = this.source.length/this.itemsPerPage;
}
else{
_pages = int(this.source.length/this.itemsPerPage)+1;
}
}


//public methods
[Bindable]
public function get itemsPerPage():Number{
return _itemsPerPage;
}

public function set itemsPerPage(value:Number):void{
_itemsPerPage = value;
this.pages = 0;
if(this.currentPage > this.pages){
this.currentPage = this.pages;
}
}

[Bindable]
public function get currentPage():Number{
return _currentPage;
}

public function set currentPage(value:Number):void{
_currentPage = value;

}

[Bindable]
public function get pages():Number{
return _pages;
}

public function pageUp():void{
if(this.currentPage < this.pages){
this.currentPage += 1;
}
}

public function pageDown():void{
if(this.currentPage > 1){
this.currentPage -= 1;
}
}

public function pageFirst():void{
if(this.currentPage > 1){
//Alert.show("Yes, got the action");
this.currentPage = (pages + 1) - pages;
}
}

public function pageLast():void{
if(this.currentPage < this.pages){
this.currentPage = pages;
}
}


}
}


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 6+5 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions