Ext.onReady(function(){
   Ext.create('Ext.panel.Panel', {
    width: 500,
    height: 400,
    title: 'Border Layout',
    layout: 'border',
    items: [{
        title: 'South Region is resizable',
        region: 'south',     // position for region
        xtype: 'panel',
        height: 100,
        split: true,         // enable resizing
        margins: '0 5 5 5'
    },{
        // xtype: 'panel' implied by default
        title: 'West Region is collapsible',
        region:'west',
        xtype: 'panel',
        margins: '5 0 0 5',
        width: 200,
        collapsible: true,   // make collapsible
        id: 'west-region-container',
        layout: 'fit'
    },{
        title: 'Center Region',
        region: 'center',     // center region is required, no width/height specified
        xtype: 'panel',
        layout: 'fit',
        margins: '5 5 0 0'
    }],
    renderTo: Ext.getBody()
    });
      var store = Ext.create('Ext.data.TreeStore', {
    root: {
        expanded: true,
        children: [
            { text: "detention", leaf: true },
            { text: "homework", expanded: true, children: [
                { text: "book report", leaf: true },
                { text: "alegrbra", leaf: true}
            ] },
            { text: "buy lottery tickets", leaf: true }
        ]
    }
});var treeTest = Ext.create('Ext.tree.Panel', {
    //title: 'Simple Tree',
     store: store,
      margins: '3 0 3 3',
    cmargins: '3 3 3 3',
    width: 200,
     //minSize : 150,   
     maxSize : 200, 
    autoHeight:true,
    store: store,
    rootVisible: false,
    renderTo: 'west-region-container'
});
   
});
borderexttreelayout

解决方案 »

  1.   


     var treeTest = Ext.create('Ext.tree.Panel', {
        //title: 'Simple Tree',
         store: store,
          margins: '3 0 3 3',
        cmargins: '3 3 3 3',
        width: 200,
         //minSize : 150,   
         maxSize : 200, 
        autoHeight:true,
        store: store,
        rootVisible: false
    });        title: 'West Region is collapsible',
            region:'west',
            margin: '5 0 0 5',
            width: 200,
            collapsible: true,   // make collapsible
            layout: 'fit',
            items :[treeTest]
    不要用renderTo到那个border里面试试!