Found : def showonly(): query=(db.personnel.present=='present') #links=[{'header':T('picture'),'body':lambda row: IMG(_src=row.picture, _width=50, _height=40, _id='picture')}] db.personnel.picture.represent = lambda pic,row : IMG(_src=URL('default', 'download', args=pic)) grid = SQLFORM.grid(query=query, user_signature=False, maxtextlength = 40,deletable=False, \ editable=False, create=False, details=False, \ #links=links, \ fields=[db.personnel.nom,db.personnel.burtelephone,db.personnel.mail,db.personnel.groupe, db.personnel.picture],orderby=db.personnel.nom) return dict(grid=grid)
Le lundi 5 octobre 2015 16:27:01 UTC+2, Laurent Lc a écrit : > > Hi, > > I'd like to show pics for each records when i return a grid. My function > is : > > def showonly(): > query=(db1.test.present=='present') > grid = SQLFORM.grid(query=query, user_signature=False, maxtextlength = > 40,deletable=False, \ > editable=False, create=False, details=False, \ > links=[dict(header='picture',body=lambda row: > A(IMG(_src=URL('download', args=row.picture), _width=50, _height=50), > _href=URL('download', args=row.picture)))], \ > > fields=[db1.test.nom,db1.test.burtelephone,db1.test.mail,db1.test.groupe, > db1.test.picture],orderby=db1.test.nom) > return dict(grid=grid) > > The pic does not appear (header pb i think, but i follow the doc and i do > not understand) > And there are 2 times the field "picture" in the columns (it works when i > click on the link "file") > > So i would like to have just one column "picture" whith a pic inside .... > > thank you > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.