Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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?

like image 732
maximus Avatar asked Oct 25 '25 14:10

maximus


1 Answers

Update replaces HTML content.

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().

like image 170
jvenema Avatar answered Oct 27 '25 02:10

jvenema



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!