I am using crud.select() to show a nice SQLTABLE list of the items in
a kit.
What I'd like to be able to do is to amend the quantity of items
directly within this table, but my attempts so far are failing because
I can't pass the row into the .represent.
Simplified model:
db.define_table('kit',db.Field('item_id'),db.Field('quantity'))
Controller:
def kit():
table=db.kit
table.quantity.represent=lambda qty: INPUT
(value=qty,requires=IS_NOT_EMPTY())
list=crud.select(table)
return dict(list=list)
I want to be able to do something like:
table.quantity.represent=lambda qty,record: INPUT
(value=qty,_name=record,requires=IS_NOT_EMPTY())
table.quantity.represent=lambda qty: SQLFORM(table,record,fields=
['quantity'],showid=False)
table.quantity.represent=lambda qty: FORM(INPUT
(value=qty,_name=record,requires=IS_NOT_EMPTY()))
If I can't do form-fields directly inside the table then at least
links would be good, but this has the same problem:
table.quantity.represent=lambda qty: A(qty,_href=URL
(r=request,f='kit_quantity',args=[record,qty]))
How can I pass the record into the lambda?
- or do something which achieves the same thing...
Many thanks,
Fran.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---