【问题标题】:Handling errors with uxiframe component处理 uxiframe 组件的错误
【发布时间】:2017-12-20 16:05:47
【问题描述】:

我的应用程序从网格数据生成一个带有 fpdf 的报告,该报告显示在带有 uxiframe 组件的选项卡上。 效果很好。

但是,我需要处理错误。

uxiframe 支持加载方法,但它没有任何成功或失败方法或成功属性。

假设服务器发送以下响应:

{msg: "Problem...", success: false}

我用一个按钮添加一个带有 uxiframe 的新标签

 var newTab = mainPanel.add({
     xtype: 'uxiframe',
     closable: true,
     title: 'PDF report',
     src: 'php/fpdreport.php,
     listeners:{
          load: function(operation){
                 console.log(operation);
          }
     }
  });

有什么方法可以显示消息“问题...”吗?

已编辑:

小提琴:https://fiddle.sencha.com/#view/editor&fiddle/2bj7

测试用PDF:'https://examples.sencha.com/extjs/5.1.0/examples/executive-dashboard/resources/reports/Q42013Report.pdf'

【问题讨论】:

    标签: extjs extjs5


    【解决方案1】:

    应该是这样的:-

    Ext.application({
        name: 'Fiddle',
        requires: ['Ext.ux.IFrame'],
        launch: function () {
    
            var panel = Ext.create('Ext.Panel', {
                renderTo: Ext.getBody(),
                items: [{
                    xtype: 'uxiframe',
                    closable: true,
                    title: 'PDF report',
                    loader: {
                        url: 'php/fpdreport.php',
                        autoLoad: true,
                        callback: function (ths, success, response, options) {
                            console.log(response);
                            panel.setHtml(response.statusText);
                        }
                    }
                }]
            });
    
        }
    });
    

    希望对您有所帮助。

    【讨论】:

    • 感谢 imEnCoded,但这不起作用;尝试使用小提琴并将 pdf 添加到我的帖子中,
    • 你好 josei,我已经用小提琴试过了,这是fiddle.sencha.com/#view/editor&fiddle/2bju
    • 你好 imEnCoded。在我的帖子中尝试使用 pdf 进行测试。回调函数在加载器上工作正常,但不加载 uxiframe 组件或 pdf 文档。
    猜你喜欢
    • 2019-03-17
    • 2018-07-24
    • 1970-01-01
    • 2014-08-25
    • 1970-01-01
    • 2010-11-12
    • 2017-10-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多