why am I getting an error AttributeError: 'Row' object has no attribute 'id'
when I try to set links = [lambda row: A('',_class='glyphicon glyphicon glyphicon-remove-sign', callback=URL('settings','deactivate',vars=dict(table='workers_skills',field = 'ws_status' ,value = row.id )))], 2015-09-23 22:44 GMT+08:00 A3 <a3v...@gmail.com>: > explained here: > > https://groups.google.com/d/msg/web2py/asCPsD9UGb8/ksmYX0UjBx0J > > Op dinsdag 22 september 2015 04:22:39 UTC+2 schreef Yebach: >> >> Ok thanx. This worked. >> >> One more question. My SQLFORM.grid is not refreshed after callback. So >> record stays there. HOw to do a grid refresh? >> >> 2015-09-19 20:32 GMT+08:00 Anthony <abas...@gmail.com>: >> >>> On Saturday, September 19, 2015 at 4:18:49 AM UTC-4, Yebach wrote: >>>> >>>> Hello >>>> >>>> So I managed to put link and create it but now I have a probelm getting >>>> the id of the record I want to deal with >>>> >>>> links = [lambda row: A('',_class='glyphicon glyphicon >>>> glyphicon-remove-sign', >>>> callback=URL('settings','deactivate',vars=dict(table='skills',field = >>>> 'sk_status', value = form.vars.id )))] >>>> >>> >>> If you want the id of the record in a given row of the table, then >>> instead of value=form.vars.id, it should be value=row.id. >>> >>> >>>> @auth.requires_login() def deactivate(): ##Aktiviramo delavca ko user >>>> klikne na activate user = auth.user_id org = db(db.auth_user.id == >>>> user).select(db.auth_user.organization)[0]["organization"] #Worker je id >>>> zaposlenenga ki ga damo v aktiven id = request.vars["id"] >>>> >>> >>> In the URLs generated in the grid, you used the variable name "value", >>> yet here you are looking for the variable name "id". The above line should >>> be: >>> >>> id = request.vars.value >>> >>> Or you can change the URLs to use "id" as the variable name. >>> >>> Anthony >>> >>>> -- >>> 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 a topic in the >>> Google Groups "web2py-users" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/web2py/3T1Qaf39wJg/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> web2py+un...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Lep pozdrav >> >> Vid Ogris >> >> >> -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/3T1Qaf39wJg/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Lep pozdrav Vid Ogris -- 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.