Hello everyone, according to the Book, the smartgrid can be passed a map of
parameters, eg searchable=dict(parent=True, child=False), and this will be
passed to the appropriate grids that the smartgrid creates.
Now I am wondering how to pass an onvalidation call back to both a parent
and a child. Here's my code
def documents():
response.title = 'Employee Documents '
get_default_company_id() or redirect(URL('company', 'companies'))
grid = SQLFORM.smartgrid(db.employee, deletable=False,
linked_tables=['employee_document'], csv=False,
orderby=dict(employee=db.employee.last_name,
employee_document=db.employee_document.document_type),
onvalidation=dict(employee=on_validate,
employee_document=on_validate_doc),
showbuttontext=dict(employee=False,
employee_document=False)
)
return dict(grid=grid)
but this results in an error
<type 'exceptions.RuntimeError'> Invalid key in onvalidate dict
If I remove the onvalidation part from the above code, it runs fine.
So my question again is, how do I pass a function to be called for onvalidation
for a child grid created from a smartgrid? Thanks
--
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.