首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

ExtJs4.2中把Panel嵌入到tabPanel的有关问题

2013-03-14 
ExtJs4.2中把Panel嵌入到tabPanel的问题本人初学ExtJs,在实现一个在TabPanel中嵌入一个Panel的时候,一直显

ExtJs4.2中把Panel嵌入到tabPanel的问题
本人初学ExtJs,在实现一个在TabPanel中嵌入一个Panel的时候,一直显示不出来。
以下是部分代码:


  var docListSearchStore = ed.common.getStore({
        //something
        autoLoad: true  
      });
  var searchForm = new Ext.form.Panel({
        //something
      items : {
              store : docListSearchStore,
              },
        renderTo: Ext.getBody()
      });

  var treeStore =  Ext.create('Ext.data.TreeStore',{
                     root:{
                          expanded:true,
                          text:'Root',
                          children:[
                               {text:'p1',leaf:true},
                               {
                                    text:'p2',
                                    leaf:false,
                                    expanded:false,
                                    children:[
                                         {text:'p2-1',leaf:true},
                                         {
                                              text:'p2-2',
                                              leaf:true,


                                              href:'treegrid.html',
                                              hrefTarget:'_self'
                                         }
                                    ]
                               }
                          ]
                     }
  });

var tree = new Ext.tree.Panel({
          id : 'tree',
          width:270,
          height:400,
          title:ed.'Test2',
          renderTo:Ext.getBody(),
          autoScroll : true,
          iconCls : 'tabHierarchy',
          enableDD : false,
          store:treeStore,
          rootVisible:false,
          useArrows:true,
          columns: [{
            text: 'haha',
            width: 270,
            dataIndex: 'DOC_UNIT_ID',
            sortable: true
          }]
      });

        var docTabPanel = new Ext.tab.Panel({
          x : 0,
          y : 0,
        width:270,
        height:400,
        activeTab : 'tree',
        id : 'docTabPanel',
        items :[{
        title: 'tree',
        html: tree 
    }, {
        title: 'searchPanel',


        html: searchPanel
    ],
        renderTo: Ext.getBody()
      });


以上是我的部分代码,可是这段代码却一直运行不起来,不能够正常显示,不能够正常的加载到tabPanel里,不知道因为什么原因导致的,请高手帮我指点一下,先谢谢了 extjs javascript autoload
[解决办法]
下面我给你写了一下你的treepanel加到tabpanel里面。

var treeStore =  Ext.create('Ext.data.TreeStore',{
                     root:{
                          expanded:true,
                          text:'Root',
                          children:[
                               {text:'p1',leaf:true},
                               {
                                    text:'p2',
                                    leaf:false,
                                    expanded:false,
                                    children:[
                                         {text:'p2-1',leaf:true},
                                         {
                                              text:'p2-2',
                                              leaf:true,
                                              href:'treegrid.html',


                                              hrefTarget:'_self'
                                         }
                                    ]
                               }
                          ]
                     }
  });
 
var tree = new Ext.tree.Panel({
          id : 'tree',
          width:270,
          height:400,
          title:'Test2',
          autoScroll : true,
          iconCls : 'tabHierarchy',
          enableDD : false,
          store:treeStore,
          rootVisible:false,
          useArrows:true
      });
 
        var docTabPanel = new Ext.tab.Panel({
        x : 0,
        y : 0,
        width:270,
        height:400,
        activeTab : 'tree',
        id : 'docTabPanel',
        items :[{
        title: 'tree',
        items: [ tree ]
    }],
        renderTo: Ext.getBody()
      });

热点排行
Bad Request.