Accessing an iframe inside a tab panel extjs4.2

喜欢而已 提交于 2019-12-12 03:13:37

问题


I have a tab panel formed of two tabs. I'm trying to access the iframe in each tab by using "window.frames["id"]" but i'm getting undefined when alerting it. How to access the iframe in my case?

 tabPanel = Ext.create('Ext.tab.Panel', {
            region: 'center',
            activeTab: 0,
            autoScroll: true,
            items: [
                    {   
                        id:"panel_A",
                        title: "${tr.A}",
                        html: "<iframe src= '"+A_url +"' width='100%' height='100%' id='frm_A' name='frm_A' frameborder=0 />",
                    },{
                        id:"panel_B",
                        title: "${tr.B}",
                        //disabled:tabs_status,
                        //hidden:hidden,
                        html: "<iframe src='"+B_url +"'  width='100%' height='100%' id='frm_B' name='frm_B' frameborder=0 />",
                    }]
            });


        viewport = new Ext.Viewport({
            layout:'border',
            items:[tabPanel]
        });

回答1:


To select DOM elements you can use Ext.dom.Query.select(), alias Ext.query().

Ext.dom.Query Provides high performance selector/xpath processing by compiling queries into reusable functions. New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in).

More about navigating through DOM with ExtJS in this answer.

Try something like Ext.query('iframe#frm_A');

Working fiddle



来源:https://stackoverflow.com/questions/34831078/accessing-an-iframe-inside-a-tab-panel-extjs4-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!