简体   繁体   English

如何替换ExtJS中的组件

[英]How to replace a component in ExtJS

I have an ExtJS window, with a toolbar at the top, and loads with plain Panel at the bottom with plain HTML. 我有一个ExtJS窗口,顶部有一个工具栏,底部带有普通面板,带有纯HTML。 This works fine. 这很好用。 On a button click, I'd like to be able to replace the bottom panel (called content), with another panel. 点击按钮,我希望能够用另一个面板替换底部面板(称为内容)。 If tried this 如果试过这个

var clickHandler = function(calendar){
    // 'content' is the panel id
    // calendar is also an Ext.Panel object
    Ext.getCmp('content').update(calendar); 
};

What am I missing? 我错过了什么?

Update replaces HTML content. 更新将替换HTML内容。

You want to remove the old panel and add the new. 您想要删除旧面板并添加新面板。 Try .remove()ing the old panel and .add()ing the new one, and don't forget .doLayout(). 尝试.remove()对旧面板和.add()进行新面板,并且不要忘记.doLayout()。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM