2012-01-19 95 views
0

我的樹面板在刪除和添加它後不渲染ExtJS 4.我的樹面板不渲染

這是我grid panel'selection change'處理程序:

selectionChange : function(selmodel, selection, eOpts) { 
    var selected = selection.length > 0; 
    if (selected) { 
     var view = Ext.getCmp('viewportCenterId'); 
     view.removeAll(); 
     if (selection[0].get('id') == '1') { 
      view.add({ 
       xtype:'publicationTree' 
      }); 
     } else if (selection[0].get('id') == '0') { 
      view.add({ 
       xtype: 'userinfoform' 
      }); 
     } 
    } 
} 

publicationTree是我tree panel並沒有渲染後

當我想把這個tree panel的區域第一次加載時,此代碼正在工作。 (我通過xtype將代碼放在我的樹面板中)。

{ 
    region: 'center', 
    id: 'viewportCenterId', 
    collapsible: false, 
    width: '60%', 
    border: true, 
    items:{ 
     xtype:'publicationTree', 
     width: '100%', 
     height: '100%' 
    } 
} 

回答

0

1.Try指定佈局而不是寬度和高度:

{ 
    region: 'center', 
    id: 'viewportCenterId', 
    layout: 'fit', 
    collapsible: false, 
    width: '60%', 
    border: true, 
    items:{ 
     xtype:'publicationTree' 
    } 
} 

2.Try還在這裏,如果加入發行後手動調用view.doLayout()。

+0

我已經試過它,不幫:( –