Jquery Dialog - Is there a way to open it without registering it using .dialog?

Posted by Raja on Stack Overflow See other posts from Stack Overflow or by Raja
Published on 2010-05-20T16:16:51Z Indexed on 2010/05/21 11:50 UTC
Read the original article Hit count: 218

Filed under:
|

This is my problem. I have a page with multiple tabs. I load those tabs dynamically and one of those tabs is a message container (mail). Every time I click a folder link (Inbox, Sent Mail etc) I reload just that tab alone with appropriate content. I use Jquery dialog to pick contacts and I have to load contacts everytime. Since I reload the whole tab content every time JQuery Dialog registers (or creates) the whole div content. To avoid this I did this:

if ($("#ui-dialog-title-divContacts").length == 0) { //if dialog data is not created then make dialog
            $("#divContacts").dialog({
                bgiframe: true,
                resizable: false,
                autoOpen: false,
                height: 600,
                width: 425,
                modal: true,
                overlay: {
                    backgroundColor: '#000',
                    opacity: 0.5
                },
                buttons: {
                    Cancel: function () {
                        //basically do nothing
                        $(this).dialog("close");
                    },
                    'Done': function () {                                                        
                        $("#divTo").empty().html($("#divSelectedContacts").html());
                        $(this).dialog("close");
                    }

                }
            });
        }

I went to generated viewsource in FF and found that only one instance is being created. My problem now is it is not showing the dialog. Is there a way by which I can open this dialog without registering it. Any help is much appreciated.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-dialog