In a controller that shows a grid/smartgrid, I have three parts.The first
part is before the call to the SQLFORM.smartgrid, then next is the call to
SQLFORM.smartgrid and the third part is after the call to SQLFORM.smartgrid.
In the first part I inspect the request.args to figure out what the grid is
going to do. For example:
if 'edit' in request.args:
db.person.email.writable=False
db.person.street_address.label="where is your house"
This will prevent the user from editing the email in the edit form
If there are linked tables I can also detect it and prepare a title like:
"This is a list of cars owned by John Smith"
In general request.args is your friend. Print it out and see what
information is there
The last part is after the call to SQLFORM.smartgrid. Here you can
manipulate the serialized HTML data by for example changing the "+Add
record" text to "+Add person" in the auto generated button
On Saturday, June 3, 2017 at 6:32:15 AM UTC+2, T.R.Rajkumar wrote:
>
> As said I did this in controller but there is no effect in either create
> or edit forms of amc_master or amc_details. I added the closing parenthesis
> for the first dict. Anything I miss?
>
> form = SQLFORM.smartgrid(db.amc_master,
> linked_tables=['amc_details'],
> user_signature=False,
> fields=dict(amc_master=list_of_fields),
> formstyle='table3cols',
> headers=headers,
> formargs={'amc_master':
> dict(labels=[{'lrrflg': 'Rate Revision'}]),
> 'amc_details': dict(labels=[{'qty':
> 'Quantity'}])}
> )
>
--
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.