Forum Discussion

omygoodness's avatar
8 years ago

Pagination through array

Hi,

I am trying to create ranking page which is based on user points.

 

For now I have around 5000 users who are counted and added to freemarker array. I am sorting array by points and I have problem with pagination.

 

I have proper pages count but every page sorts array based on offset and I get sorted elements which is fine but instead of sort 5000 elements it sorts 10 or 20 depends on offset.

 

Is there a way to create one array and paginate through sorted results?

<@component id="common.widget.pager" pageableItem=pageable_item />

 I would like to achieve something like this:
kudos/leaderboardpage/timerange/one_month/page/1/tab/authors

 

There is a pagination but results are sorted globally.

  • omygoodness - The overall processing would take too long since you have so many users in the array. The Lithium API also wouldn't allow to access more than 1000 results in one go. You can maybe look into sorting this by your core logic in FTL - slow but the only way.