views:

39

answers:

1

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

http://code.google.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.

+1  A: 

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.

David Underhill
Ok I'll do that, thanks.