The 1.6 behavior is correct.  Calling .dialog() instantiates a dialog;
trying to re-instantiate an already instantiated dialog will do
nothing.  As you've noted, the proper way to open a dialog after it
has been instantiated is to use .dialog('open').  What you want to do
is initialize the dialog outside of the click event and set the
autoOpen option to false.  Then always use .dialog('open') to open the
dialog.

On Jan 31, 6:44 am, Paul Carey <[email protected]> wrote:
> Hi
>
> I'm not sure if this is considered a bug, but I wanted to clarify
> behaviour is as expected, as it differs from 1.5.
>
> In 1.5 $("#dg").dialog() always opens the dialog.
> In 1.6 $("#dg").dialog() only opens the dialog on the first
> invocation.
>
> The issue arises when I want to open a the same dialog multiple times.
> In 1.6 I need to write
> $("#dg").dialog().dialog("open");
> to ensure it always open. Perhaps this isn't correct API usage and I
> should be writing something like
>
> if (dg == null) {
>  dg = $("#dg").dialog();} else {
>
>  dg.dialog("open");
>
> }
>
> but such usage doesn't strike me as being idiomatic jQuery. Test case
> below.
>
> Best regards
>
> Paul
>
> ====
>
> <html>
> <body>
>   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/
> jquery.min.js"></script>
>   <script src="http://ui.jquery.com/repository/tags/testing/ui/
> minified/jquery.ui.all.min.js" type="text/javascript"></script>
>   <script>
>     $(document).ready(function () {
>       $("#open-dg").click(function () {
>         $("#dg").dialog(); // opens the dialog on the first click only
>         // $("#dg").dialog().dialog("open"); // always opens the
> dialog
>       });
>     });
>   </script>
>   <div id="open-dg">open dialog</div>
>   <div id="dg">dialog</div>
> </body>
> </html>
--~--~---------~--~----~------------~-------~--~----~
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