Add a paging plugin in Flex DataGrid?

Is there a library or plug-in that can be added to a Flex project to add pagination to the Flex Datagrid?
the source code of this paginated datagrid can be found here.




import mx.collections.ArrayCollection;
import mx.events.ItemClickEvent;
import mx.controls.Button;
import mx.controls.Alert;

[Bindable]
public var myData:ArrayCollection = new ArrayCollection();
public var orgData:ArrayCollection = new ArrayCollection();
[Bindable]
public var nav:ArrayCollection = new ArrayCollection();
public var pageSize :uint = 10;
public var navSize:uint = 10;
private var index:uint = 0;
private var navPage:uint = 1;

private function InitApp():void
{
for( var x:uint = 1; x <= 500; x++ )
{
var obj:Object = new Object();
obj.Id = x.toString();
obj.Name = "Column "+ x.toString();
obj.Street = "5555 Street";
obj.Title = "CEO";< br /> obj.City = "El Paso";

orgData.addItem(obj);
}
refreshDataProvider(index);
createNavBar(Math.ceil (orgData.length/pageSize));
}

private function createNavBar(pages:uint = 1,set:uint = 0):void
{
nav .removeAll();
if( pages> 1 )
{
if( set != 0 )
{
nav.addItem({label:"<< ",data:0});
if( (set-navSize) >= 0 )
{
nav.addItem({label:"<" ,data:set-navSize});
}
else
{
nav.addItem({label:"<",data:0});
}
}

for( var x:uint = 0; x {
var pg:uint = x + set;
nav.addItem({label: pg + 1,data: pg});
}
if( pg {
nav.addItem({label: ">",data:pg + 1});
nav.addItem({label:">>",data:pages-pageSize});
}
}
}

private function navigatePage(event:ItemClickEvent):void
{
refreshDataProvider(event.item.data);
var lb:String = event.item. label.toString();
if( lb.indexOf("<")> -1 || lb.indexOf(">")> -1 )
{
createNavBar(Math.ceil(orgData.length/pageSize),event.item.data);
if( event.item.data == 0 )
{
pageNav.selectedIndex = 0;
}
else
{
pageNav.selectedIndex = 2;
}
}

}

private function refreshDataProvider(start:uint):void
{
myData = new ArrayCollection( orgData.source.slice((start * pageSize),(start * pageSize) + pageSize) );
}
]]>






Is it possible to add To the library or plug-in of the Flex project to add pagination to the Flex Datagrid?

The source code of this paginated datagrid can be found here.




import mx.collections.ArrayCollection;
import mx.events.ItemClickEvent;
import mx.controls.Button;
import mx.controls.Alert;

[Bindable]
public var myData:ArrayCollection = new ArrayCollection();
public var orgData:ArrayCollection = new ArrayCollection();
[Bindable]
public var nav:ArrayCollection = new ArrayCollection();
public var pageSize:uint = 10;
public var navSize :uint = 10;
private var index:uint = 0;
private var navPage:uint = 1;

private function InitApp():void
{< br /> for( var x:uint = 1; x <= 500; x++ )
{
var obj:Object = new Object();
obj.Id = x.toString();
obj.Name = "Column " + x.toString();
obj.Street = "5555 Street";
obj.Title = "CEO";
obj.City = "El Paso";
< br /> orgData.addItem(obj);
}
refreshDataProvider(index);
createNavBar(Math.ceil(orgData.length/pageSize));
}

private function createNavBar(pages:uint = 1,set:uint = 0):void
{
nav.removeAll();
if( pages> 1 )
{
if( set != 0 )
{
nav.addItem({label:"<<",data:0});
if( (set- navSize) >= 0 )
{
nav.addItem({label:"<",data:set-navSize});
}
else
{
nav.addItem({label:"<",data:0});
}
}

for( var x:uint = 0; x {
var pg:uint = x + set;
nav.addItem({label: pg + 1,data: pg}) ;
}
if( pg {
nav.addItem({label:">",data:pg + 1});
nav.addItem({label:">>",data:pages-pageSize});
}
}
}

private function navigatePage(event:ItemClickEvent ):void
{
refreshDataProvider(event.item.data);
var lb:String = event.item.label.toString();
if( lb.indexOf( "<")> -1 || lb.indexOf(">")> -1 )
{
createNavBar(Math.ceil(orgData.leng th/pageSize),event.item.data);
if( event.item.data == 0 )
{
pageNav.selectedIndex = 0;
}
else
{
pageNav.selectedIndex = 2;
}
}

}

private function refreshDataProvider(start: uint):void
{
myData = new ArrayCollection( orgData.source.slice((start * pageSize),(start * pageSize) + pageSize) );
}
] ]>






WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5898 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.