http://www.web2py.com/AlterEgo/default/show/95

On Jun 14, 12:32 pm, Salerno il Calabrese
<salernoilcalabr...@googlemail.com> wrote:
> Hello,
>
> I am new to web2py and this group. Would be thankful if someone could
> help me to paginate the results/hits of search.
>
> Suppose the following case:
>
> ---in models---
>
> db.define_table('table_name',
>      SQLField('Title','text',),
>      SQLField('Artist','string',length=256))
>
> -- in Controllers --
>
> def show_records():
>     form=FORM(TABLE(TR(("",INPUT
> (_type="text",_name="searchFor",requires=IS_NOT_EMPTY())),
>                     ("",INPUT(_type="submit",_value="Search")))
>                     ))
>     query=(
>             ((db.table_name.Title.like('%%%s%%'
> %request.vars.searchFor))
>             )|(db.table_name.Artist.like('%%%s%%'
> %request.vars.searchFor))
>     results=db.(query).select(distinct=True)
>     return dict(form=form, results=results)
>
> Now I want to display the results in a paginated form, let us say 10
> records per page.
> How to do this?
>
> Regards
> Salerno
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to