开发者

Adding or Replacing a new Panel to inside a Window in Ext JS


Problem has been solved already, Thanks anyways :)


I've got a Ext.Window object. something like:

var mypanel= new Ex开发者_JAVA百科t.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]
});

I'm trying to replace 'mypanel' with another Ext.Panel object when the user triggers a specific event. So i figured I could remove mypanel and than add a new panel to it. I got the removing working. The adding however is a different story, I've tried stuff in the direction of:

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

I'll be happy with any answer for either replacing the existing panel or adding a new panel.

Thank you.


After adding items, you should call doLayout() on the container.

// 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();

should do the trick

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜