Thanx, it was as you pointed out. But how can I correctly use the modal window. It's working but the code is quiet dirty. On Nov 15, 2012 9:03 PM, "Richard Vézina" <ml.richard.vez...@gmail.com> wrote:
> I am not pretty experienced with SQLFORM.grid, but the way you use > bootstrap modal seems wrong... > > About the id problem, I notice that one time use row.id and the other > row.office.id maybe your problem come from there?! > > Richard > > On Thu, Nov 15, 2012 at 12:58 AM, Teddy Nyambe <software....@gmail.com>wrote: > >> Hi, >> >> I have the following action in the controller, doing a join to display >> "office name" and a reference to department of "department name" to >> which office belongs...but i have an error in the link since I have a >> modal window am opening to edit/add/delete details...this is the >> error: >> >> <type 'exceptions.AttributeError'> 'Row' object has no attribute 'id' >> >> >> def office(): >> db.office.id.readable = False >> query = ((db.office.department == db.department.id)) >> #((db.contact.date_of_birth < “1990-11-18”)) >> fields = (db.office.name, db.department.name) >> link = [lambda row: A('Edit', _class='btn', _role='button', >> _onclick='dept_edit('+str(row.office.id)+');',**{'_data-toggle':'modal'}) >> ,lambda row: A('Delete', _class='btn', _role='button', >> _onclick='dept_delete('+str(row.id)+');',**{'_data-toggle':'modal'})] >> headers = {'db.office.name': 'Office Name','db.department.name': >> 'Department'} >> default_sort_order=[db.office.name] >> >> form = SQLFORM.grid(query=query, headers=headers, >> orderby=default_sort_order ,links=link, create=False, deletable=True, >> editable=False, maxtextlength=64, paginate=25) >> return dict(form=form) >> >> How do I pass an id of a row in lambda for the link parameter of the >> SQLFORM.grid. >> >> Been stuck with this error for a day now!! >> >> Kind regards, >> >> Teddy L. >> >> -- >> >> >> >> > -- > > > > --