javascript - 如何在ExtJS中为Iframe设置Id?

标签 javascript extjs extjs5

我有一个 HTML 页面要在 ExtJSiframe 中显示。我想为特定的 iframe 设置一个 id,我该怎么做?

请引用下面的示例代码,我已经分配了一个sampleId,但它根本不起作用。

Ext.application({
    name: 'Fiddle',
    launch: function () {
        Ext.create('Ext.window.Window', {
            title: 'Open other html file inside of window',
            height: 500,
            width: 500,
            layout: 'fit',
            items: [{
                xtype: "component",
                autoEl: {
                    id: "sampleId",
                    tag: "iframe",
                    src: "res/example.html"
                }
            }]
        }).show();
    }
});

最佳答案

id 的设置移至组件本身:

items: [{
    xtype: "component",
    id: 'sampleId',
    autoEl: {
        tag: "iframe",
        src: "res/example.html"
    }
}]

关于javascript - 如何在ExtJS中为Iframe设置Id?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51411978/

相关文章:

javascript - Sencha touch 2 - 自定义组件开发数据项未从存储加载值

extjs5 - 模型中的 Extjs 5.0 嵌套关联导致错误 = Ext.data.schema.Schema.addEntity() : Duplicate entity name

javascript - 带模板的显示字段

javascript - 如何在面板中添加 2 个按钮来折叠/展开 ExtJs 网格中的所有组?

javascript - 如何获取当前值和最大值(进度条)的差值?

ExtJs 标签文本更改

javascript - 按属性和链接文本对 div 中包含的链接进行排序

javascript - 将 HTML 显示为文本的组合框

javascript - execCommand ('insertHTML' ) 正在占用空间

javascript - 从 jquery 移动多选获取字符串放入数据库