超出最大调用堆栈大小。在对话框打开

时间:2021-08-17 22:15:05

In my project I've a dialog that display two buttons (confirm and cancel) the action. But when this appears, if I move or I click on a button with a function associated with me cause this error:

在我的项目中,我有一个对话框,显示两个按钮(确认和取消)操作。但是当出现这种情况时,如果我移动或点击一个带有与我相关联的功能的按钮会导致此错误:

Uncaught RangeError: Maximum call stack size exceeded.

未捕获RangeError:超出最大调用堆栈大小。

This is the function that display the dialog:

这是显示对话框的功能:

displayConfirmMessageBox: function(title, message, messageButtons) {
    if(title == undefined || title == ''){
        title = "<No message>";
    }   
    if(message == undefined || message == ''){
        message = "<No message>";
    } 
    if(messageButtons == undefined){    
        messageButtons = {};
        messageButtons[EALang['close']] = function(){   
            jQuery("#message_box_confirm").dialog("close");
        };
    }

    jQuery("#message_box_confirm").dialog("destroy");
    jQuery("#message_box_confirm").remove();
    jQuery("body").append(
        "<div id='message_box_confirm' title='" + title + "'>" +
        "<p>" + message + "</p>" +
        "</div>"
    );    

    jQuery("#message_box_confirm").dialog({
        autoOpen      : false,
        modal         : true,
        resize        : "auto",
        width         : 400,
        height        : "auto",
        resizable     : false,
        buttons       : messageButtons,
        closeOnEscape : true
    });

    jQuery("#message_box_confirm").dialog("open"); 
    jQuery(".ui-dialog .ui-dialog-buttonset button").addClass('btn');
    jQuery("#message_box_confirm .ui-dialog-titlebar-close").hide();
},

and this is the function that call the displayConfirmMessageBox:

这是调用displayConfirmMessageBox的函数:

var messageButtons = {};

messageButtons['OK'] = function(){
    conferma = true;
    BackendCalendar.completeAppointmentStore(conferma, successCallback, errorCallback);
};

messageButtons[EALang['cancel']] = function(){
    conferma = false;
    $('#message_box_confirm').dialog('close');
};

GeneralFunctions.displayMessageBox(
    EALang['delete_resource_confirmation'], 
    EALang['warning_resource'], 
    messageButtons
);

What am I doing wrong?

我究竟做错了什么?

1 个解决方案

#1


4  

Fixed with modal: true on modal:false (better way delete this parameter).

修正了modal:true on modal:false(更好的方法是删除此参数)。

#1


4  

Fixed with modal: true on modal:false (better way delete this parameter).

修正了modal:true on modal:false(更好的方法是删除此参数)。