问题已经解决了,谢谢:)
我有一个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]
});
当用户触发特定事件时,我试图将'mypanel‘替换为另一个Ext.Panel对象。所以我想我可以移除它,而不是增加一个新的面板。我做了移除手术。然而,添加的是一个不同的故事,我尝试的方向是:
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
无论是更换现有的面板还是添加新的面板,我都会对任何答案感到满意。
谢谢。
发布于 2011-01-26 02:13:47
添加项之后,应该在容器上调用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();
应该做点什么
https://stackoverflow.com/questions/4803249
复制相似问题