Hi Annet,

I will give you an example using db.person since I don't know which
fields you want displayed.

rr=db().select(db.person.ALL) # or whatever selection
rr.hooks=False # only the data
maxk=min(24,len(rr))
# 6 rows with id and name fields
r1=[TR(rr[k].id,rr[k].name) for k in range(0,min(6,maxk))]
# other rows with only id
r2=[TR(rr[k].id,_colspan=2) for k in range(6,maxk)]
r1.extend(r2)
t=TABLE(r1)

# if you want all fields in r1, and adjust colspan in r2
r1=[TR(*rr[k]) for k in range(0,min(6,maxk))]

Hope this helps,
Denes.


On Sep 19, 2:27 am, annet <annet.verm...@gmail.com> wrote:
> I have a table which contains news items. In the view I would like to
> display the first 6 items in full and limit the display of the next 18
> items to their title. So something like:
>
> {{for item in news:}}
> <div class="newsitem">
>   <h5>{{=db.nieuws.publicatie_datum.formatter(item.publicatie_datum)}}
> </h5>
>   <h2>{{=item.titel}}</h2>
>   {{if item.ondertitel:}}<h3>{{=item.ondertitel}}</h3>{{pass}}
>   {{=XML(item.korte_inhoud)}} <br />
>   <h4>{{=A('Lees meer',_onmouseover="this.style.cursor='pointer;",\
>      _onclick="javascript:newsdetails('%s')"%URL
> (r=request,f='newsdetails',args=[item.id]))}}</h4>
> </div> <!-- newsitem -->
> {{pass}}
>
> <table>
>   <tbody>
>     {{for item in news:}}
>       <tr>
>         <td>
>           {{=item.titel}}
>         </td>
>       </tr>
>     {{pass}}
>   </tbody>
> </table>
>
> I hope one of you could provide me with the correct for loop to make
> this work.
>
> Kind regards,
>
> Annet.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to