When I use row.id in links i get an error, row has no attribute id? My links is in controler before i create SQLFORM.grid.
What am I doing wrong On Friday, March 1, 2013 at 11:31:54 PM UTC+8, Niphlod wrote: > > disclaimer: not tested: in a controller, prepare a function > > def check_to_true(): > if not request.args(0): > return '' > db_events.alerts(request.args(0)).update_record(checked=1) > > and then pass links in the grid as > links = [ > dict(header='check the rec', > body=lambda row : A('check', _class='btn', _href='#', callback= > URL('check_to_true', args=row.id)) > )] > > > This should create a clickable button that calls your function and sets > the checked to true without leaving the page holding the grid (ajax). > If you need to refresh the values also on the grid page, than a full > refresh of the page is needed, so remove the callback argument, use that > url in the href and put a redirect(URL('function_showing_the_grid')) at the > end of the "check_to_true" function. > > On Friday, March 1, 2013 4:08:05 PM UTC+1, Christian Espinoza wrote: >> >> Hi guys, I want to add a action button(like delete,edit, view, i/e) at >> the grid, something to change a value from the record indicated at the line, >> this is my table: >> >> db_events.define_table('alerts', >> Field('type', length=20, label='Clase' ), >> Field('rule', label='Regla'), >> Field('value', length=30, label='Valor'), >> Field('detail', label='Detalle'), >> Field('coords', length=20, label='Coordenadas'), >> Field('checked', 'integer', label='Chequeada', default=0 ),# >> 1 to checked >> Field('created_on', 'datetime', label='Recibida', default= >> request.now) >> ) >> >> The idea is have a button to check the alert, I mean: will be put a 1 at >> "checked" field of the record when the button will be clicked >> >> Thanks for your time and support! >> Christian. >> >> -- 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.