If you're calling .dialog('destroy') then you'll need to call the
.dialog(options) init to open again. But instead you can simply call
.dialog('close') and .dialog('open')

- Richard

On Sat, Oct 31, 2009 at 7:20 PM, Rushi <[email protected]> wrote:

> I tried it but now the dialog doesn't open at all !! When I am closing
> the dialog, I am calling .dialog('destroy') so that it's instance is
> cleared from memory. But, I guess the destroy is not happening
> correctly. I am sure it's something to do about having the old
> instance in memory and I just have to figure out a way on where to
> place the creation/open/destroy calls in the code. Interestingly, I
> have other dialogs that follow the same pattern as above and are
> working just fine. The only difference is that their content is
> static. So, may be the problem is there but I don't see it because the
> dialog content never changes.
>
> On Oct 31, 1:44 am, Mean Mike <[email protected]> wrote:
> > I'm thinking that you need to move this
> >
> > $("#mydialog").dialog({modal:true, autoOpen:false, title:Title,
> > width:800, height:380});
> >
> > out of the open OpenDialog function and have that in your document
> > ready function
> >
> > see whats happening is that it creating a new instance of .dialog
> > every timeyou call OpenDialog()
> >
> > I'm not sure if used the right terms there but that's essentially
> > whats happening
> >
> > Mean Mike
> >
> > On Oct 30, 9:54 pm, Rushi <[email protected]> wrote:
> >
> >
> >
> > > Hi,
> >
> > > I have a strange problem with JQuery modal dialog. I am using the
> > > following code to open my dialog.
> >
> > > function OpenDialog()
> > > {
> > >     UpdateDIVForThisDialog();
> > >     $("#mydialog").dialog({modal:true, autoOpen:false, title:Title,
> > > width:800, height:380});
> > >     $("#mydialog").dialog("open");
> >
> > > }
> >
> > > function UpdateDIVForThisDialog()
> > > {
> > >     var URL = "MyURL";
> > >     var Parameters = "MyParameters";
> >
> > >     $.ajax({
> > >       url: URL,
> > >       async: false,
> > >       data: Parameters,
> > >       cache:false,
> > >       type: "GET",
> > >       dataType: "html",
> > >       success: function(UserData)
> > >       {
> > >           document.getElementById("mydialog").innerHTML = UserData;
> > >       }
> > >      });
> >
> > > }
> >
> > > It's a straightforward piece of code that gets some data via an AJAX
> > > call and updates the innerHTML of the div tag that is then used by the
> > > OpenDialog function. The strange thing happening is that the div's
> > > innerHTML seems to be cached when the dialog is opened. This leads to
> > > the dialog showing the HTML of the earlier AJAX call. Please note that
> > > the AJAX call does return me the new HTML because I displayed it using
> > > an alert and I did see the new HTML. I also did an alert on
> > > document.getElementById("mydialog").innerHTML and I see that the "new"
> > > HTML content is set to the div tag. But, somehow, when the dialog is
> > > opened, it shows me the old HTML. If it helps, the HTML is retrieved
> > > from a MVC View and I tried setting the cache-control and all such
> > > properties so there is no caching. But, I don't think thats the
> > > problem because I do get the new HTML back from the server. It's the
> > > dialog that somehow remembers the old div tag contents. If I refresh
> > > the browser, I do see the correct contents in the dialog. The issue
> > > happens in IE, Firefor and Chrome. So, I don't think it's browser
> > > specific. I tried destroying the dialog before opening but it doesn't
> > > work either. I am unable to find out the reason for this strange
> > > behavior. Any help would be greatly appreciated.- Hide quoted text -
> >
> > - Show quoted text -
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "jQuery UI" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<jquery-ui%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/jquery-ui?hl=en.
>
>
>

--

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


Reply via email to