Skip to Content
avatar image
Former Member

Create a ViewContainer and embed view inside it at runtime.

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Aug 30, 2007 at 09:32 PM

    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

    Add comment
    10|10000 characters needed characters exceeded