将内容加载到Kendo UI KendoWindow中时处理错误

我有一个KendoWindow,可以将内容从JSP加载到iFrame中。 我已经在每个位置附加了错误处理程序,但是当JSP不可用时,这些错误处理程序都不会被调用。 将content加载到KendoWindow中时,处理错误的正确方法是什么?

     win.kendoWindow({
        width : "860px",modal : true,height : "680px",iframe : true,resizable : false,content : { 
            url: "access/lookup/Source.jsp",failure: function(err) {
                console.log(e.status);
                console.log(e.xhr);
            },error: function(err) {
                console.log(e.status);
                console.log(e.xhr);
            }
        },error: function(err) {
            console.log(e.status);
            console.log(e.xhr);
        }
     });
lxx1990123 回答:将内容加载到Kendo UI KendoWindow中时处理错误

如果您深入研究source code,则会看到:

if (!showIframe) {
    // perform AJAX request
    that._ajaxRequest(options);
} else {
    iframe = element.find("." + KCONTENTFRAME)[0];
    // Edited for clarity
    iframe.src = url || iframe.src;
}

showIframe(如果未在选项中设置)定义为:

showIframe = !isLocalUrl(url);

因此,只有执行ajax请求的代码执行分支才使用您的错误处理程序。 else分支只执行一个iframe,然后让浏览器对其进行处理。

iframe: false添加到内容选项中,如here所示,将会有所帮助。

本文链接:https://www.f2er.com/3169718.html

大家都在问