On Thursday, August 20, 2015 at 3:28:47 AM UTC-7, Iancic Bogdan wrote:
>
> I have a lot of entries in the table that I want to display, and as i 
> already have other things on the same page, i want to make this table show 
> only 10-20 entries per page. How can I add that?
>
>
Essentially, you're going to use "limitby" in the query, and then when the 
user wants to look at more data, use a trigger (for instance, a "more" 
button) to reload the page with the new data, or use an ajax function to do 
a partial load.

<URL:http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#orderby--groupby--limitby--distinct--having-orderby_on_limitby-left-cache>
<URL:http://web2py.com/books/default/chapter/29/11/jquery-and-ajax#Ajax-form-submission>

Note that the application's appadmin page uses "limitby", and does a page 
reload with the URL updated to 
"//myserver/myapp/appadmin/select/db?start=100".

Good luck!

/dps

 

> Here is the code I wrote in view:
>
>     {{if prints:}}
>     <h3>{{=T('Print history:')}}</h3>
>     {{i=0}}
>     <table>
>         <thead>
>                 <th>#</th>
>                 <th>{{=T('Component name')}}</th>
>                 <th>{{=T('Component code')}}</th>
>                 <th>{{=T('Number of components')}}</th>
>                 <th>{{=T('Printing date')}}</th>
>         </thead>
>         <tbody>
>             {{for design in prints:}}
>                 <tr><td>{{=i+1}}</td><td>         
> {{=design.fk_printhistory_componentcatalog.component_name}}</td><td>{{=design.fk_printhistory_componentcatalog.component_code}}</td><td>{{=design.no_of_components}}</td><td>{{=design.time_stamp}}</td></tr>
>             {{i=i+1}}
>             {{pass}}
>         </tbody>
>     </table>
>     {{pass}}
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to