pagination example
[edit|delete]example:
def show_records():
if len(request.args):
page=int(request.args[0])
else:
page=0
query=db.table.id>0 ### for example
rows=db(query).select(limitby=(page,page+100))
backward=A('backward',_href=URL(r=request,args=[page-100]) if page else ''
forward=A('forward',_href=URL(r=request,args=[page+100]) if len(rows) else ''
return dict(rows=rows,backward=backward,forward=forward)
Comments
fpp.gsp on 2008-05-01 09:01:41 says
The backward and forward definitions are both missing a closing parenthese before the "if" :
100]) should be 100])) in both cases.
[inappropriate?]
The backward and forward definitions are both missing a closing parenthese before the "if" :
100]) should be 100])) in both cases.
[inappropriate?]