Calling .dialog() and passing in a hash initializes the dialog - this
can only happen once.  To open a dialog after it has been initialized,
you need to do $(el).dialog('open');

Try this:

$("#delpicdialog").dialog({
        autoOpen: false,
        title: 'Are you sure?',
        modal: true,
        resizable: false,
        height: 100,
        overlay: {
                opacity: 0.7,
                background: '#7ec244'
        }
});

function delPic(path)
{
        $('#delpicdialog').dialog('option', 'buttons', {
                "Ok": function() {
                        $.post('delfile.php', { filedir: path, dir: _currentDir 
},
                                function(data) {
                                        $('#files').html(data);
                                });
                        $(this).dialog("close");
                },
                "Cancel": function() {
                        $(this).dialog("close");
                }
        });

        $('#delpicdialog').dialog('open');
}


On Oct 24, 5:10 pm, Sander <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm making a custom image viewer in AJAX/PHP. I customized the jQuery
> filetree plugin I found on abeautifulsite.net to only show folders in
> the filetree, and show thumbnails of all images in the selected folder
> in another div.
>
> Each image can be deleted when clicking on the 'delete' link next to
> the image. This shows a jQuery Dialog, asking whether the user is sure
> or not. When 'Ok' is clicked here, the image gets deleted, and the div
> with the image files is reloaded. This is all AJAX, the page isn't
> reloaded entirely once.
>
> Now for my problem: the dialog box will only show up once. When the X
> is clicked, 'Cancel' is chosen or 'Ok' is clicked, the dialog box
> won't open again. I need to reload the entire page for the dialog box
> to show up again (when a 'delete' link is clicked, of course).
>
> This is the code I'm using to show the dialog box;
>
> function delPic(path)
> {
>         $("#delpicdialog").dialog({
>                 title: 'Are you sure?',
>     modal: true,
>     resizable: false,
>     height: 100,
>     overlay: {
>         opacity: 0.7,
>         background: '#7ec244'
>     },
>         buttons: {
>         "Ok": function() {
>                                         $.post('delfile.php', { filedir: 
> path, dir: _currentDir },
> function(data) {
>                                                 $('#files').html(data);
>                                         });
>                                         $(this).dialog("close");
>         },
>         "Cancel": function() {
>             $(this).dialog("close");
>         }
>     }
>         });
>
> }
>
> If anyone has any solutions to my problem, that would be great. Thanks
> in advance!
>
> Sander
--~--~---------~--~----~------------~-------~--~----~
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