this is how i use onclick for confirmation purpose in a grid: lambda row: A('Copy', _class='btn', _onclick='return confirm("Duplicate %s?")' % row.po_number, _href=URL('duplicate_po',args=[row.id])),
On Monday, December 17, 2012 2:46:59 PM UTC-5, Kenneth wrote: > > Hi, > > anybody have any ideas? > > tablerow.components.insert(2, TD(IMG(_src=URL('static', > 'delete-article.png'), _onclick="confirmation(rowdata.asset_id)", > _width=15))) > > Kenneth > > > Den måndagen den 17:e december 2012 kl. 00:40:10 UTC+2 skrev Kenneth: >> >> Hello, >> >> I'm using webgrid in an application and I'm trying to insert an delete >> image into the table to shows all rows in an table. When clicking on the >> delete image I want an onclick event to trigger a Javascript that confirms >> and deletes that row. To do that I need the rownumber. >> >> Looks like this: >> def controller that uses webgrid(): >> grid.row_created = add_add_serial_link >> >> def add_add_serial_link(tablerow,rowtype,rowdata): >> if rowtype == 'datarow': >> >> tablerow.components.insert(2, TD(IMG(_src=URL('static', >> 'delete-article.png'), _onclick="confirmation(rowdata.asset_id)", >> _width=15))) >> >> How do I write that _onclick so that the asset_id is sent to the >> confirmation Javascript? If I write >> _onclick='confirmation("rowdata.asset_id")' Javascript gets the text >> rowdata.asset_id and not the ID I'm tryin to send to it. >> >> >> Kenneth >> >> >> >> --