Changes between Version 9 and Version 10 of ServerSidePagination


Ignore:
Timestamp:
01/20/10 03:19:47 (15 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ServerSidePagination

    v9 v10  
    1010fractalis has offered to look at this
    1111
    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
    1316
    14 We already have options to filter the results within a busy REST controller, so could do something like:
     17=== HTML Back-end implmentation ===
     18Patched the {{{models\01_RESTlike_Controller}}}.
    1519{{{
    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))
     20shn_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...
     34items = crud.select(table, query=query,
     35            ...
     36            limitby=limitby,
     37            ...
     38            )
    2039}}}
    21 Unfortunately query doesn't include the .select()
    2240
    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 ===
    2642Maybe look at the currently-unused {{{modules/webgrid.py}}}.
    2743