2013-09-30 84 views
0

我有三个文件:form.html,report.html,console.html。我遇到了console.html页面的两个问题。ExtJs自动加载脚本不执行

  • 我试图加载“report.html”,但只加载静态内容, ExtJS的组件没有加载或者说是不执行脚本。

  • 我想加载'form.html'。在这段代码中,我能够成功加载form.html和extJs组件。但问题是,一旦加载了tab2,我无法激活/查看tab1。

    感谢您的帮助。没有任何错误的autoLoad的任何例子都可以。

    Console.html是如下:

<head> 
    <title>Sample Console</title> 
    <link rel="stylesheet" type="text/css" href="../ExtJs/resources/css/ext-all.css" /> 
    <script type="text/javascript" src="../ExtJs/ext-all-debug.js"></script> 
    <script type="text/javascript"> 
     Ext.onReady(function() { 
      Ext.create('Ext.panel.Panel', { 
       renderTo: 'frmSampleConsole', 
       split: true, 
       height : '100%', 
       width : '100%', 
       layout:'border', 
       defaults: { 
        collapsible: true, 
        split: true 
        //bodyStyle: 'padding:15px' 
       }, 
       items: 
       [ 
        { 
         title: 'Report', 
         region : 'west', 
         width : 280, 
         autoLoad : 'report.html', 
         contentType: 'html', 
         scripts : true 
        } 
        , 
        { 
         id :'tabpanel', 
         xtype:'tabpanel', 
         title: 'Main Content', 
         collapsible: false, 
         region:'center', 
         items : [ 
          { 
           id : 'tab1', 
           title: 'Tab1', 
           collapsible: false, 
           margins: '5 0 0 0', 
           activeTab:0, 
           items: [ 
            { 
             html : 'Sample html content' 
            } 
           ] 
          }, 
          { 
           id :'tab2', 
           title : 'Tab2', 
           layout : 'fit', 
           closable: true, 
           loader: { 
            url: 'form.html', 
            contentType: 'html', 
            autoload: true, 
            loadMask: true, 
            scripts: true 
           }, 
           listeners: { 
            render: function(tab) { 
             tab.loader.load(); 
            } 
           } 
          } 
         ] 
        } 
       ] 
      }); 

     }); 
    </script> 
</head> 
<body> 
    <div id = 'frmSampleConsole'></div> 
</body> 
</html> 
+1

你不能加载extjs库两次,这我不会去工作。你的静态内容应该保持静态,否则你将需要使用iframe。 – dbrin

回答

0

您需要设置 “scripts: true,” 那么你的ExtJS的脚本是工作。