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