In your table each row is a field but which record should this correspond 
to?

given a record you can do

    record = db.sounder[some_record_id]

    a_field=[]
    field_header=TR(TH('Characteristic'),TH('Typical'),TH('Comments'))
    for f in db.sounder:
       a_field.append([ f.label ,* record[f.name]  *,  f.comment  ])



On Friday, 9 January 2015 22:18:16 UTC-6, Ben Lawrence wrote:
>
> I have a table with many different kinds of fields:
>
> db.define_table('sounder',
>                 Field('part_nr','string',label='Part Number'),
>                 Field('current_mA','double',label='Current 
> mA',comment='max current at rated voltage'),
>                 Field('current_notes','string',label='Current Measurement 
> Conditions',comment='e.g. current was measured at 12V (DC) or at 4.1kHz and 
> 5 Vpp'),
>                 Field('spl','double',label='Sound Pressure Level dB at 
> 30cm'),
> etc etc
>
> I would like to make a html table just like a datasheet. So In my 
> controller:
>     a_field=[]
>     field_header=TR(TH('Characteristic'),TH('Typical'),TH('Comments'))
>     for f in db.sounder:
>        a_field.append([ f.label ,* f  *,  f.comment  ])
>
> In my view (say)
> {{=TABLE(THEAD(field_header),
> TBODY(
>       a_field[0],
>       a_field[1],
>       a_field[2],
>     etc etc
> ),_class="table table-bordered")}}
>
> But you see, I need the middle column *(in red above)* to be the actual 
> value of the field. The above does not give this.
>
> How can I get the actual value of the field from its object?
>
>
>
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to