View Full Version : Problem in sorting the DataGrid with pagination

02-13-2009, 02:21 PM
I have a datagrid with pagination. On default it sorts only the current page data.

requirement is : sort across all records returned in result set, not only the records for the current page.

Need Help . Please share the sapmle code.


02-13-2009, 02:42 PM
What is this for, and can you show us what you have so far (code and link)?

02-14-2009, 12:57 PM
Hi Thanks a lot for reply.

Below is the links from which I followed for the Datagrid pagination:


Datagrid Pagination is working fine for me .But facing the problem in grid sorting.
By default it sorts the records for the current page.
But it should sort across all records returned in result set i.e it should sort whole data grid.

If you will look into the code of paging example from the above link:

myData = new ArrayCollection( orgData.source.slice((start * pageSize),(start * pageSize) + pageSize) );

<mx:DataGrid id="dg" dataProvider="{myData}" />

Though the grid is populating from myData arraycollection, so it sorts the current page. On cliking the grid header for sorting , if we can sort the orgData and refresh the myData arraycollection from sorted orgData arraycollection, It could resolve my problem.

Need your help / suggestion . Please share the code sample