For the pagination I went through the documentation and understood that it is based on a cursor where you have to specify it to navigate back and forth. I have a requirement to navigate to first page and last page. Like you normally see in conventional Jquery or related grids with 4 buttons. Is this achievable? Also I would like to show the current page of the cursor like "Page 2 of 10". Is there anyway I can get this record count in the same response when you query?
Asked
Active
Viewed 158 times
1 Answers
1
Unfortunately, there really isn't a way to get to the last page. What you are describing is generally referred to as "limit,offset paging", which is common in MySQL or Postgres.
Usergrid currently only supports cursors. Due to the nature of the way cursors work, you have to navigate through the results in a linear fashion, starting at the beginning.

rockerston
- 521
- 2
- 10
-
Thank you for the reply. Yes according to the docs this is described like that. But I am curios since in the portal app they list the no of users. Hence there should be a way to get the total count of entities? Hence just checking whether atleast can get that with a custom query with a where clause. – Dilshan Jun 18 '15 at 18:20
-
The counts in the portal are not accurate and should only be considered an estimate until they are fixed (my understanding is that this will happen in the 2.x branch). There isn't a way to get an accurate total count of entities at the moment. Since introducing ElasticSearch in 2.x, this functionality will likely be possible, but it isn't available now. I can see how you might be able to order your results using the "created" timestamp first asc, then desc to get the first and last pages. Then use the cursors from those queries to traverse the set from either direction. – rockerston Jun 20 '15 at 01:23
-
The above is probably not what you had in mind, but one possible way to solve the problem. GET /stuffs?ql=order by created ASC – rockerston Jun 20 '15 at 01:23
-
Thank you. Where can I find the 2.x branch? – Dilshan Jun 20 '15 at 05:58
-
I believe this is the current 2.0 branch: https://github.com/apache/incubator-usergrid/tree/two-dot-o But you may want to visit the website: http://usergrid.incubator.apache.org/ and ask this question on the dev mailing list. – rockerston Jun 27 '15 at 14:57