Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在Ext JS中向窗口内部添加或替换新面板_Javascript_Extjs - Fatal编程技术网

Javascript 在Ext JS中向窗口内部添加或替换新面板

Javascript 在Ext JS中向窗口内部添加或替换新面板,javascript,extjs,Javascript,Extjs,问题已经解决了, 无论如何,谢谢:) 我有一个外部窗口对象。 比如: 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,

问题已经解决了, 无论如何,谢谢:)


我有一个外部窗口对象。 比如:

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= 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
无论是更换现有面板还是添加新面板,我都乐意接受任何答案


谢谢。

添加项目后,应在容器上调用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();
我们应该这样做