0

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]
        });
mikeb
  • 709
  • 2
  • 9
  • 35
  • Is there any particular reason as to why you are electing to use IFRAMEs instead of using standard ExtJS panels for your tabs? – Steven Jan 17 '16 at 02:13
  • Oh, and to access your IFRAMEs from the DOM you should just use `document.getElementById('frm_A')` – Steven Jan 17 '16 at 02:17

1 Answers1

0

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

Community
  • 1
  • 1
Sergey Novikov
  • 4,096
  • 7
  • 33
  • 59