I'm looking at the code in ui.dialog.js.

Tell me, how is your Delete button materializing the dialog?  See,
('#dialog_name').dialog('isOpen') does not query the state of the
dialog pane.  It's just a state-flag with no context-specific smarts
at all.

For example, you could say '#dialog_name').show() or .hide() and that
doesn't change the value of Dialog._isOpen.  It's just a dumb flag,
yet it controls various aspects of the dialog.

So tell us more about the code behind your Delete button.

Another consideration: the code only closes the dialog upon Ajax
success.  What about the non-success case?  There's a "complete"
callback that is invoked in either case...

**--**  Steve




On Dec 20, 11:46 pm, Ladio <vladimir.m...@gmail.com> wrote:
> Hi Steve,
>
> I tried your suggestion and i can see the HTML for the dialog pane.
> It's ID is "cdConfirm" in both cases, when it works and when it
> doesn't work. I really don't know why it is not working :( Actually
> the code that i wrote above i have included in a javascript function
> (deleteProduct(....)), so every time i click on delete icon, the
> function will be called... I don't know if that's wrong...
>
> On Dec 21, 12:25 pm, Steven Black <ste...@stevenblack.com> wrote:
>
> > Depending on which browser you are using, what do you see when you
> > Right+Click and "Inspect element" while the mouse cursor is on the
> > dialog?  You should see the HTML code belonging to the dialog pane
> > and, from that, the proper ID.
>
> > **--**  Steve
>
> > On Dec 20, 11:57 am, Ladio <vladimir.m...@gmail.com> wrote:
>
> > > 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