On Friday, June 15, 2018 at 12:57:54 PM UTC-4, watr wrote:
>
> Here is my links code:
>
> links = [
> dict(header='Balance', body=lambda row: row.po.amount -
> row.invoice_items.amount_pretax),
> dict(header='Controls', body=[
> lambda row: A('Invoices',_class='button btn
> btn-default',_href=URL('invoice', 'list', args=['commitment', row.po.id],
> vars=dict(source=here))),
> lambda row: A('Edit',_class='button btn
> btn-default',_href=URL('edit', args=row.po.id, vars=dict(source=here))),
> lambda row: A('Files',_class='button btn
> btn-default',_href=URL('attachments', 'list', args=['commitment',row.po.id],
> vars=dict(source=here))),
> lambda row: A('Delete',_class='button btn
> btn-default',_href=URL('delete', args=row.po.id, vars=dict(source=here)))
> ]
> ]
>
> However, I get an "attribution error" for the first dict,
>
Presumably either row.po.amount or row.invoice_items.amount_pretax are
incorrect.
> and a "list not callable" for the controls dict.
>
The "body" item of the dictionary must be a callable that takes the row
object and outputs a web2py string or web2py HTML DOM element. It cannot be
a list of functions. If you want to generate a set of links, generate them
all in a single function and wrap them in CAT() or DIV() (or whatever works
for the desired layout within the table cell).
Anthony
--
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.