index.jsp 页面里面有一个 tabPanel组件 其中包含了一个含有GridPanel的 myshop_grid.jsp页面,现在我想 点击 GridPanel 后 可以调用 index.jsp 里面的tabPanel 增加一个页面 有办法做到吗?  

解决方案 »

  1.   

    myshop_grid.jsp 在 index.jsp中 ?你用了iframe?
      

  2.   


    var tabPanel = new Ext.TabPanel( {
    region : 'center',
    enableTabScroll : true,
    deferredRender : false,
    activeTab : 0,
    items : {
                    id: "index",
    title : 'index',
    autoLoad :{url:'http://localhost:8080/myboxcn_cs/admin/MyJsp.jsp?shopLocationid=0',scripts:true},
    closable : 'true'

    });
      

  3.   

    这样写会跨域,用iframe就不会了,如果在本地就无所谓了。
    子窗体访问父窗体用parent.函数名();//函数在index.jsp中写好。
      

  4.   

    http://www.javaeye.com/topic/265347//子窗体访问父窗体
      

  5.   

    直接增加一个tab即可,在index.jsp页面添加一个方法addTab
    function addTab(strTitle,url) {
    tabs.add({          
              title: strTitle,          
              html: '<iframe frameborder=\"0\" style=\"overflow:auto; width:100%; height:100%;border:0px;\" src=\"'+url+'\"></iframe>',
              closable:true
            }).show();
    }
    在myshop_grid.jsp页面也就是在GridPanel中添加tab,调用window.parent.addTab("tab", "a.jsp");
    因为GridPanel是tabPanel的一个tab的组件,故可以调用window.parent.addTab即调用父页面的方法
      

  6.   

    上面的方法是没有用的
    我刚刚在index.jsp 页面里添加如下函数var addPanel = function(event) {
    Ext.Msg.alert('ext','welcome you!');
    }     
    在myshop_grid.jsp 页面里面 
    使用  window.parent.addPanel(); 是访问不到的
      

  7.   


    我刚刚尝试了 使用 你所说的方法 
    这样添加了一个页面进来{
    id:"index2",
    title:'index2',
    html: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="test.jsp"> </iframe>',

    }但是依旧不能够访问到 index.jsp页面内的函数
      

  8.   

     parent.Ext.getCmp('tabp').add({
    id: "index3",
    title : "index3",
    autoLoad :{url:'http://localhost:8080/myboxcn_cs/MyJsp.jsp?shopLocationid=0',scripts:true},
    closable : 'true',
    });tabp 为 tabPanel 的 id