Suppose I have such a code:

def products():
  if len(request.args): page=int(request.args[0])
  else: page=0
  items_per_page=20
  limitby=(page*items_per_page,(page+1)*(items_per_page+1))
  qset = db(db['products']['name']!='None')
  grid = qset.select(limitby=limitby)
  return dict(grid=grid,page=page,items_per_page=items_per_page)

My view: 

{{extend 'layout.html'}}<h2>Browse available products:</h2>
<table class="products">{{for i, row in enumerate(grid):}}{{if 
i==items_per_page:break}}<tr><td>{{=row.name}}</td>{{pass}}</tr></table>
{{if page:}}<a href="{{=URL(args=[page-1])}}">previous</a>{{pass}}
{{if len(grid)>items_per_page:}}<a 
href="{{=URL(args=[page+1])}}">next</a>{{pass}}

I have 'next' button and 'previous' button. How do I get the 'last' button(page 
with the last items on the list?
Regards

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to