If you are generating the table in your view manually, make sure it has a thead tag. You can also use SQLTABLE to generate a DataTables compliant table.
On Nov 4, 1:04 pm, FERNANDO VILLARROEL <fvillarr...@yahoo.com> wrote: > Hello All. > > Regarding of pagination. > > Anyone could me explain how i can use Datatables; i am trying but not works. > > Or if anyone could send to me a example how i can use it. > > Regards. > > Fernando > --- On Wed, 11/4/09, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > From: mdipierro <mdipie...@cs.depaul.edu> > > Subject: [web2py:34574] Re: web2py pagination> To: "web2py-users" > > <web2py@googlegroups.com> > > Date: Wednesday, November 4, 2009, 11:30 AM > > > limitby=(a,b) > > > returns rows[i] for a <= i < b > > > On Nov 4, 3:30 am, Mengu <whalb...@gmail.com> > > wrote: > > > hi everyone. > > > > i have a problem with paginating my results. i guess i > > didn't > > > understand the logic in limitby. > > > > normally an sql query SELECT * FROM post LIMIT 2 > > OFFSET 0 displays the > > > first 2 results. And I can get the first 2 records > > with db > > > (db.post.id>0).select(limitby(0,2)). so limit is 2 > > and offset is 0. > > > > however the problem is, this query fails: > > > db(db.post.id>0).select(limitby(2,2)). in this > > query the limit is 2 > > > and the ofset is 2 either. however it doesn't return > > select * from > > > post limit 2 offset 2 but it returns select * from > > post limit 0 offset > > > 2 because in sql.py 2846 limit is lmax - lmin and > > offset is lmin. i > > > have edited that line as sql_o += ' LIMIT %i OFFSET > > %i' % (lmax, lmin) > > > and it is working as expected. now my pagination is > > working. > > > > here is my codes for pagination: > > > perpage = 2 > > > totalposts = db(db.post.id > 0).count() > > > totalpages = totalposts / perpage > > > page = int(request.vars.page) if request.vars.page > > else 1 > > > limit = int(page - 1) * perpage > > > posts = db(db.post.id > > > 0).select(orderby=~db.post.id, limitby=(limit, > > > perpage)) > > > > please let me know if there's another page for doing > > this. > > > > sincerely > > > Mengu > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---