Changes between Version 27 and Version 28 of ServerSidePagination
- Timestamp:
- 01/20/10 05:40:54 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ServerSidePagination
v27 v28 42 42 {{{ 43 43 { 44 " rEcho": 1,44 "sEcho": 1, 45 45 "aaData": [ 46 46 [row1.id, row1.field2, ...], … … 55 55 {{{ 56 56 def callback(): 57 print request.vars 57 iDisplayStart = int(request.vars.iDisplayStart) 58 iDisplayLength = int(request.vars.iDisplayLength) 58 59 from gluon.serializers import json 59 query = .... 60 rows = db(query).select() #<<< 61 r=dict(rEcho=1, 62 iTotalRecords=len(rows), 63 iTotalDisplayRecords=len(rows), 64 aaData=[[row.field1,row.field2] for row in rows]) 60 _table = '%s_%s' % (request.controller, request.function) 61 table = db[_table] 62 query = (table.id > 0) 63 rows = db(query).select(limitby = (iDisplayStart, iDisplayStart + iDisplayLength)) 64 r = dict(sEcho = 1, 65 iTotalRecords = len(rows), 66 iTotalDisplayRecords = len(rows), 67 aaData = [[row[f] for f in table.fields if table[f].readable] for row in rows]) 65 68 return json(r) 66 69 }}} 67 If you print request.vars you can easy figure out what paramers are being passed and change the <<< line accordingly. 70 68 71 === JSON Back-end implementation === 69 72 * Support already present in {{{modules\s3xrc.py}}}