Here is a small component i wrote for implementing a paginated Datagrid on flex.
This component extends dataGrid, displaying only a set of records at a time, thereby organizing the entire collection into ‘pages’.
This component arranges the collection specified under the ‘dataProvider’ attribute into ‘pages’.
- Displays a footer at the bottom
- Indicates currently displayed records
- 2 navigation buttons (Previous, Next)
Here is how you add the control,
Replace the dataGrid tags with the one specified below.
Ofcourse, ‘component’ points to the directory ‘pagedDatagrid.as’ component exists in. If your using the component as is, its xmlns:component=”com.immy.*”
<component:paginatedDatagrid ย pagination=true limit=100…..><component:columns>……</component:columns></component:paginatedDatagrid>
Two additional attributes have been added,
Pagination (Boolean) : Indicates whether pagination is required. false allows the datagrid to function as the default datagrid.
Limit (Number): Number of records displayed on each page.
Tested for arrayCollection dataProvider’s on Flex 3 and Flex 4.
View Demo
View Source
Download
— Update 04/07/2010 —
Updates :
paginatedDatagrid now implements a method to return the currently selected index.
itemSelected (returns Number): Returns the current selectedIndex irrespective of the selected ‘Page’.
ASDocs Documentation now included
Documentation
Leave a Reply