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?
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}}
*Assuming, you are getting prints
from db and wants pagination in your table.
You can use limitby
in select
. This web2py slice will help you.