cancel
Showing results for 
Search instead for 
Did you mean: 

Create a ViewContainer and embed view inside it at runtime.

Former Member
0 Kudos

Situation:

In the moment i created the tabs and the containers dynamic, but when i choose one specific tab i need to create in runtime a ViewContainer and embed an existing view inside it.

I would like to know if is it possible???

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182294
Active Contributor
0 Kudos

Hi Rodrigo,

There is no API support to embed a View into the View container dynamically. But I tried this way...this is mix of static and dynamic way of doing..

- Created TabStrip under root container.

- Created a ViewContainerUIElement under root container and embeded the view inside it.

in the wdModifyView() I have done following code:

if(firstTime)

{

//get the root container

IWDTransparentContainer root = (IWDTransparentContainer)view.getElement("RootUIElementContainer");

//get the tab strip dynamically

IWDTabStrip tabStrip = (IWDTabStrip)view.getElement("tab_strip");

//Create a tab...

IWDTab newtab =(IWDTab)view.createElement(IWDTab.class,"tab1");

//get the View cotnainer element

IWDViewContainerUIElement viewEle = (IWDViewContainerUIElement)view.getElement("vc12");

//remove the View container from root

root.removeChild("vc12");

//Create a transaprent container

IWDTransparentContainer trans = (IWDTransparentContainer)view.createElement(IWDTransparentContainer.class,"trans_container");

//set the transparent container to tab content

newtab.setContent(trans);

//Add the view container to transpernt container

trans.addChild(viewEle);

//Add the tab to tabstrip

tabStrip.addTab(newtab);

}

And also its not possible to add the same Element mulitple times to different containers.

Regards

Abhilash