I have a custom controller in SQLFORM.grid and I am using links. The problem is (so it appears) that since I am using left join there when my custom function works, edit and view do not work.
So my links is the following
links = [lambda row: A('',_class='glyphicon glyphicon glyphicon-remove-sign',
callback=URL('settings','deactivate',vars=dict(table='workers_skills',field = 'ws_status'
,value = row.workers_skills.id )))]
my grid constructor
grid_workersskills= SQLFORM.grid(query=query,left=[db.workers.on(db.workers_skills.ws_worker==db.workers.id),
db.skills.on(db.workers_skills.ws_skill==db.skills.id)],
fields=fields, searchable=False, orderby=[db.workers.w_nick_name],create=True,
deletable=False, editable=True, paginate=50, buttons_placement = 'right',
showbuttontext = False,
links = links,
#oncreate=myfunction,
ui = dict(widget='',
header='',
content='',
default='',
cornerall='',
cornertop='',
cornerbottom='',
button='button btn btn-default',
buttontext='buttontext button',
buttonadd='icon plus icon-plus glyphicon glyphicon-plus',
buttonback='icon leftarrow icon-arrow-left glyphicon glyphicon-arrow-left',
buttonexport='icon downarrow icon-download glyphicon glyphicon-download',
buttondelete='icon trash icon-trash glyphicon glyphicon-trash',
buttonedit='icon pen icon-pencil glyphicon glyphicon-pencil',
buttontable='icon rightarrow icon-arrow-right glyphicon glyphicon-arrow-right',
buttonview='icon magnifier icon-zoom-in glyphicon glyphicon-eye-open',
),
exportclasses = dict(csv_with_hidden_cols=False, html = False, tsv = False, tsv_with_hidden_cols=False, json = False))
the problem is caused by row.workers_skills.id
If i keep it this way my function deactivate works ok, but when I click on edit or view of the record I get an error
Row attribute has no object workers_skills
If I put it to row.id the view and edit work, but my deactivate function not because ID or the record is not created.
I have been struggling with this for the last week. Please help
Thank you