struts2 - Struts-jquery dialog confirm + link id -
i using struts2-jquery , trying create modal dialog box confirmation purposes delete something. don't know how pass id or upon 'ok' complete action.
below code create dialog based on struts2-jquery:
<sj:dialog id="anchordialogconfirm" buttons="{ 'ok':function() { //id of link needed c $(this).dialog('close'); }, 'cancel':function() { $(this).dialog('close'); } }" resizable="false" autoopen="false" modal="true" title="remove?" > sure want remove it? </sj:dialog> <sj:a opendialog="anchordialogconfirm" id="71" cssclass="deleteemp">delete</sj:a>
obviously if put href='' anchor dialog opens link rather getting modal confirmation dialog.
how can retrieve id of anchor? want id of link delete or @ least suppress link being engaged until 'ok' so.
you use auxiliar variable hold data sent dialog.
in link you'd put this:
<sj:a opendialog="anchordialogconfirm" onclick="aux=%{#attr.obj.id};" href="#">remove<sj:a>
and you' wait value in dialog:
<sj:dialog id="anchordialogconfirm" buttons="{ 'ok':function() { $('#main').load('yoururl.action?id='+aux); $(this).dialog('close'); }, 'cancel':function() { $(this).dialog('close'); } }" resizable="false" autoopen="false" modal="true" title="remove?"/>
Comments
Post a Comment