Hi everyone,

I'm facing a problem with the usage of the UI dialog. I have a page
that displays a grid. Each record in the grid has a delete button.
When the delete button is clicked a jQuery dialog opens and asks for
confirmation (it contains 'Cancel' and 'Delete' buttons). If delete
button is clicked, an ajax call will be made to the server to delete
the record and then call .dialog('close') to close the dialog.

So, basically the following are the steps:

1. click the delete button
2. jQuery dialog opens
3. click the delete button
4. send ajax request to server
5. close the dialog

When i open the page and try to delete a record from the grid
everything works fine. When i try to delete another record, the dialog
opens, after clicking the delete button the ajax request is made, but
when i try to close the dialog [ $('#dialog_name').dialog('close;)  ],
it doesn't get closed. I tried to check if the dialog is open [ $
('#dialog_name').dialog('isOpen') ] and it returns FALSE. That is very
strange because the dialog is already opened...

The code is as follows:

var buttons = {};
buttons[deleteLabel] = function(){
 $.ajax({
  ...
 error: function(){
    // display error
 },
 success: function(msg){
  // show success message
  // close dialog
  $("#cdConfirm").dialog('close');
 }
 )};
}
buttons[cancelLabel] = function(){$(this).dialog('close');}

$("#cdConfirm").dialog({
 bgiframe: true,
 draggable: false,
 resizable: false,
 modal: true,
 overlay: {
  backgroundColor: '#a09987',
  opacity: 0.5
 },
 buttons: buttons
});

I really appreciate any help.

Thanks in advance,
Ladio

--

You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to jquery...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-ui+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.


Reply via email to