PDA

View Full Version : Relocating a component from one parent to another?



FoobarusMaximus
27 Sep 2011, 7:17 AM
Let's say I have three components (with ids): 'menuTop', 'menuBottom', and 'menuItem'.

'menuItem' lives in 'menuTop'. But when a certain event happens, I want to extract 'menuItem' from 'menuTop', and place it, instead, in 'menuBottom'.

Is there anything out-of-the-box in Ext JS that will allow me to move this 'menuItem' from one parent component to another?

mankz
27 Sep 2011, 8:45 AM
You should just have to call



menuTop.remove(menuItem);
menuBottom.add(menuItem);


http://docs.sencha.com/ext-js/4-0/#!/api/Ext.container.AbstractContainer-method-remove