hi,
i have an table that contain an upload field for store image, i want to
show the image in sqlform grid. i tried to using link for achieve that, it
works well (code 1), but there is no header on it, when i put the header
(code 2) like describe on the book, it return an error :
TypeError: 'str' object is not callable.
*code 1 (work, but no header):*
def product():
links=[lambda row: A(IMG(_src=URL('download', args=row.image), _width=50,
_height=50), _href=URL('download', args=row.image))]
grid=SQLFORM.grid(db.product,
*links=links)*
#links=dict(header='image',body=[lambda row: A(IMG(_src=URL('download',
args=row.image), _width=50, _height=50), _href=URL('download',
args=row.image))]))
#links=dict(header='image',body=lambda row: A(IMG(_src=URL('download',
args=row.image), _width=50, _height=50), _href=URL('download',
args=row.image))))
return locals()
*code 2 (not work return an error : TypeError: 'str' object is not
callable.):*
def product():
links=[lambda row: A(IMG(_src=URL('download', args=row.image), _width=50,
_height=50), _href=URL('download', args=row.image))]
grid=SQLFORM.grid(db.product,
#links=links)
#links=dict(header='image',body=[lambda row: A(IMG(_src=URL('download',
args=row.image), _width=50, _height=50), _href=URL('download',
args=row.image))]))
*links=dict(header='image',body=lambda row: A(IMG(_src=URL('download',
args=row.image), _width=50, _height=50), _href=URL('download',
args=row.image))))*
return locals()
how can i show the image with the header in sqlform.grid?
thanks and best regards,
stifan
--
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/groups/opt_out.