Changes between Version 9 and Version 10 of ServerSidePagination
- Timestamp:
- 01/20/10 03:19:47 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ServerSidePagination
v9 v10 10 10 fractalis has offered to look at this 11 11 12 Will need to patch into the {{{models\01_RESTlike_Controller}}}. 12 === Status === 13 * The Back-end is now done for HTML representation 14 * The Back-end needs doign for JSON representation 15 * The Front-end still needs doing 13 16 14 We already have options to filter the results within a busy REST controller, so could do something like: 17 === HTML Back-end implmentation === 18 Patched the {{{models\01_RESTlike_Controller}}}. 15 19 {{{ 16 if request.vars.page and request.vars.pagesize: 17 start = (int(request.vars.page) - 1) * int(request.vars.pagesize) 18 stop = int(request.vars.page) * int(request.vars.pagesize) 19 response.s3.filter = (db['%s_%s' % (module, resource)].id > 0).select(limitby=(start, stop)) 20 shn_list() 21 ... 22 if request.vars.limit: 23 limit = int(request.vars.limit) 24 if request.vars.page: 25 page = int(request.vars.page) 26 start = (page - 1) * limit 27 stop = page * limit 28 limitby = (start, stop) 29 else: 30 limitby = (0, limit) 31 else: 32 limitby = None 33 ... 34 items = crud.select(table, query=query, 35 ... 36 limitby=limitby, 37 ... 38 ) 20 39 }}} 21 Unfortunately query doesn't include the .select()22 40 23 We already use request.vars.limit in the search.json method/representation. 24 * we could use this & add a request.vars.page in shn_list() 25 41 === Other Options === 26 42 Maybe look at the currently-unused {{{modules/webgrid.py}}}. 27 43