2011-01-26 3 views
1

問題は おかげでとにかく、すでに解決されている:)のExt JSでウィンドウ内部に新しいパネルを追加または交換


私はExt.Windowオブジェクトを持っています。 何かのように:ユーザーが特定のイベントをトリガしたときに

var mypanel= new Ext.Panel({title:'Placeholder'}); 
var cwin = new Ext.Window({ 
    layout:'fit', 
    width:screen.width-200, 
    x:200, 
    y:150, 
    draggable: false, 
    closable: false, 
    resizable: false, 
    plain: true, 
    border: false, 
    items: [mypanel] 
}); 

私は別のExt.Panelオブジェクトと「mypanel」を置換しようとしています。 だから、私はmypanelを削除して新しいパネルを追加するよりも、 私は削除作業を得た。 しかし、追加することが、私は方向にものを試してみた別の話、 です:

mypanel= new Ext.Panel({title:'my new Panel'}); 
cwin.add(mypanel); //dit nothing 
cwin.items.add(mypanel); //dit nothing 
cwin.insert(0,mypanel); //dit nothing 
cwin.items.insert(0,mypanel); //dit nothing 

私は、既存のパネルを交換したり、新しいパネルを追加するいずれかのための任意の回答にご満足いただけることでしょう。

ありがとうございます。

答えて

3

アイテムを追加した後、コンテナでdoLayout()を呼び出す必要があります。

// remove actual contents 
cwin.removeAll(); 
// add another panel 
cwin.add(new Ext.Panel({title:'my new Panel',width:300,height:400})) 
// repaint with new contents 
cwin.doLayout(); 

トリックを行う必要があります

関連する問題