Thank you for your help.
I am currently doing the Pagination process on the GAE, but offset is limited to the number of Datastore Reads and the number of numbers that can be specified, so I am thinking of using Cursor to do the Pagination.
So I have a question, Cursor can get the next page, but if you want to get any page, I can't specify offset, so I'm not sure what to do.
For example, if you have 10 pages of content, I would like to know how to get the 4th page of content.I thought about how to extend the cursor, but I can't do it because it looks like a filan class.
Thank you for your cooperation.
google-app-engine
It's quite difficult to paginate in the datastore.
I usually set the UI to ReadMore, so I don't make Pagination.
If I were to make it
If you have only about 30 pages per page and 20 pages per page, would it be like taking 500 pages from Query.KeysOnly and reading them to the specified page in memory?
Once you search for better performance, you can keep the criteria and Cursor in Memcache, and you can bring them from Memcache unless the data changes.
It's hard to put out a page number button like bootstrap's page Nation and jump directly to a designated page because of the processing time.
You can use the Cursor start and query limit to call a key-only query twice to determine if there are any previous and next pages, so you can use the Next button and the Forward button (with active/inactive) paging.
// Search the current page
Query<Store>query=ofy().load().type(T.class).order("-created").limit(limit).startAt(cursor);
Cursor nextCursor = Cursor on the last line of the current page
// Search previous pages in reverse order
QueryKeys<T>prevQuery=ofy().load().type(T.class).order("created")
.limit(limit).startAt(Cursor.fromWebSafeString(cursor))
.keys();
// Search for the next page
ofy().load().type(T.class).order("-created")
.startAt(Cursor.fromWebSafeString(nextCursor)) .limit(1)
.keys().iterator().hasNext()
© 2024 OneMinuteCode. All rights reserved.