struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: JQuery Plugin Modal Dialog help needed
Date Mon, 10 Jan 2011 12:46:03 GMT
Seems more a JavaScript question... Does the click handler eventually return
false so the browser won't actually follow the link?

Dave
 On Jan 10, 2011 3:49 AM, "RogerV" <roger.varley@googlemail.com> wrote:
>
> Hi
>
> I've been experimenting with the JQuery sjg:grid tag and I've got to the
> stage where I can display a list of user entities and, using a custom
> formatter, add two links to each row to allow for the edit and deletion of
> individual entities. This is working well.
>
> I'm now trying to add a sj:dialog tag into the mix, so that when the
delete
> link is clicked, I can display a modal "confirmation" dialog and either
> continue with the delete or cancel the operation. What is happening now is
> that when a "delete" link is clicked, the dialog is displayed but
continues
> directly to my delete-user action without waiting for the user to respond
to
> the dialog. I suspect I'm tripping over what happens with the jquery tags
at
> "render" time on the server and execution time on the client. I'd be very
> grateful if someone could show me how to implement a "confirmation" dialog
> correctly as javascript/jquery is not a strong point of mine. I've
attached
> my code so far below.
>
> Regards
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
> pageEncoding="ISO-8859-1"%>
> <%@ taglib prefix="s" uri="/struts-tags" %>
> <%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
> <%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html>
> <head>
> <sj:head jqueryui="true" jquerytheme="redmond" />
> <script type="text/javascript">
>
> function formatEditLink(cellvalue, options, rowObject) {
> return " start-edit-user?userId=" Edit ";
> }
> function formatDeleteLink(cellvalue, options, rowObject) {
> return " delete-user?userId=" Delete ";
> }
>
> function doDelete() {
> $('#confirm_delete').dialog('open');
> }
>
> function continueButton() {
> $('#confirm_delete').dialog('close');
> return true;
> }
>
> function cancelButton() {
> $('#confirm_delete').dialog('close');
> return false;
> }
> </script>
>
> </head>
> <body>
> <h2>List Users</h2>
> <div id="gridContainer">
> <s:url id="remoteurl" action="load-user-table"/>
>
> <sjg:grid
> id="gridtable"
> caption="Users"
> dataType="json"
> href="%{remoteurl}"
> pager="true"
> gridModel="users"
> rowList="10,15,20"
> rowNum="15"
> rownumbers="false"
> editinline="false"
> >
> <sjg:gridColumn name="username" index="username" title="User Name"
> sortable="true" key="true"/>
> <sjg:gridColumn name="serial" index="serial" title="Serial#"
> formatter="integer" sortable="true"/>
> <sjg:gridColumn name="email" index="email" title="E-Mail"
> sortable="false"/>
> <sjg:gridColumn name="edit" title="" formatter="formatEditLink"
> sortable="false"/>
> <sjg:gridColumn name="delete" title="" formatter="formatDeleteLink"
> sortable="false"/>
> </sjg:grid>
> </div>
> <sj:dialog id="confirm_delete"
> title="Confirm Delete"
> autoOpen="false"
> modal="true"
> width="400"
> buttons="{
> 'Yes':function() {continueButton();},
> 'No':function() {cancelButton();}
> }"
>>
> <h5>Do you really want to delete this user. This cannot be reversed</h5>
> </sj:dialog>
> </body>
> </html>
> --
> View this message in context:
http://old.nabble.com/JQuery-Plugin-Modal-Dialog-help-needed-tp30631960p30631960.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message