开发者

datastore.Cursor - paging in reverse supported?

I'm looking at the documentation for using cursors. Are these forward-only cursors - we can't page backwards?:

http://code.goo开发者_开发技巧gle.com/appengine/docs/java/datastore/queriesandindexes.html#Query_Cursors

Cursor cursor = Cursor.fromWebSafeString(cursorString);
Map<String, Object> extensionMap = new HashMap<String, Object>();
extensionMap.put(JDOCursorHelper.CURSOR_EXTENSION, cursor);
query.setExtensions(extensionMap);
query.setRange(0, 20);

could we set the range to (-20, 0) ?

I imagine the user would want to be able to go to the previous page of elements as well as forward.


No, there is no way to go backwards with cursors with the current release.

You could "fake" it, however, by caching previous cursors.

Note: According to Alfred Fuller's Google IO talk, at some point in the future app engine will hopefully support reverse cursors too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜