Wow, "this" inside the function prefer to the button itself not the
div dialog.
A proposed solution:

function(data) {
var _dlg = $("<div class=\"dialogcontainer\"></div>").append(data);
                _dlg.dialog({
                        modal: true,
                        width: width,
                        height: height,
                        bgiframe: true,
                        buttons : {
                                '<fmt:message key="label.Terminate" /
>' : function(){
                                    $(_dlg).dialog("close");
                                },
                                '<fmt:message key="label.Modify" />' :
function(){
 
window.location=window.location;
                                },
                                '<fmt:message key="label.Print" />' :
function(){
                                        $.wait('<fmt:message
key="label.Printing" />');
                                }
                        },
                        title: 'Done'
                });

Hope it help.

On May 14, 4:22 am, GervaisB <[email protected]> wrote:
> Hi everybody,
>
> I have a dialog who is built like this :
> --- 8<
> -----------------------------------------------------------------------------------------------------
> var width = 500;
> var height = 500;
> if (navigator.appName.indexOf("Microsoft")!=-1) {
>         width = document.body.offsetWidth*0.6;
>         height = document.body.offsetHeight*0.75;} else {
>
>         width = window.innerWidth*0.6;
>         height = window.innerHeight*0.75;
>
> }
>
> $.get('<cor:url value="/frames/studentfolder/resume.html?folder=$
> {folder}" />',
>         function(data) {
>                 $("<div 
> class=\"dialogcontainer\"></div>").append(data).dialog({
>                         modal: true,
>                         width: width,
>                         height: height,
>                         bgiframe: true,
>                         buttons : {
>                                 '<fmt:message key="label.Terminate" />' : 
> function(){
>                                     $(this).dialog("close");
>                                 },
>                                 '<fmt:message key="label.Modify" />' : 
> function(){
>                                         window.location=window.location;
>                                 },
>                                 '<fmt:message key="label.Print" />' : 
> function(){
>                                         $.wait('<fmt:message 
> key="label.Printing" />');
>                                 }
>                         },
>                         title: 'Done'
>                 });});
>
> --- 8<
> -----------------------------------------------------------------------------------------------------
>
> With the first button "<fmt:message key="label.Terminate" />" I want
> to close the dialog but the line "$(this).dialog('close');" doesn't
> seems to work.
> I am under Firefox with Firebug and no errors occur..
>
> How can I close a dialog from itself ?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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