Replacing an embedded component by another one
I have created a WD component interface (let's name it INTERFACE) and I am using this in a main component (let's call it MAIN). Then I have two interface Implementations (many will follow), let's name them IMPL_1 and IMPL_2.
In the MAIN-component I have an ViewcontainerUIElement, that is connected with the Usage of the interface. When the user clicks a button, a specific implementation - e.g. IMPL_1 should be embedded there. this works by calling CREATE_COMPONENT( 'IMPL_1' ).
If the user clicks another button, another implementation of the interface should be shown there - so I remove the existing component via DELETE_COMPONENT and create the new one with CREATE_COMPONENT( 'IMPL_2' ).
That does not throw any error, but the embedded view disappears and will never come back again.
So my question is: what is the easiest way to replace an embedded component IMPL_1 with another one IMPL_2 - both implementing the same interface! This should be fairly simple, as I'm referencing just the interface in the MAIN-Component.
Any hints? I'm just finding very difficult solutions with PREPARE_DYNAMIC_NAVIGATION and so on - but I don't want to recreat all Plug-Connections again as they have been connected in the designer using the interface-definition....
Thanks in advance!
if I remember right, you have to fire a plug in order to "activate" the embedded View. So if you already have the plugs from your embedding component to the inner one try firing this plug after creating the component.