Skip to Content
avatar image
Former Member

Sharing one view (and it's logic) across multiple tabs....

I'm building an application that requires comments to be applied a myriad of different types of objects. The business logic around managing the comments is identical; the only real difference is the data source - the comments are stored in the same database table, but are prefixed with an object type, and linked to the original object.

I'm displaying each type of business object in a separate tab in a tabbed view, using the classic header-line item UI pattern. However, since the comment part of the view is the same, I'd like to know how I could share a common 'comment view' between all the panes.

Web Dynpro will only let you instantiate a view once, so embedding the same view multiple times across the tabbed views won't work.

How would I do something like this? I'm thinking that I may be able to dynamically create the view at run time, and bind the context node to the view so as to display the comments for the selected business object, but I'm concerned about performance (creating/destroying views at runtime).

Possible? You have a better way of doing it? Let me know!

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Jul 29, 2009 at 06:20 AM

    Hi Ken,

    Dynamic view cration is not possible in webdynpro java, you can go through the following forum link.

    Dynamic View creation

    what you can do is take a parent view, keep your comments in the parent view.

    Embedd a view container in the parent view and keep the tabbed views inside the view container.

    At runtime with hide and show functionality you can manage the displaying of the comments.

    you can also refer to the following forum link for a similar requirement of adding a single view in different tabs

    Dynamic embedding 1 view in several tabs

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 29, 2009 at 06:30 AM

    Hi,

    My suggestion is create the view at designtime and place the controls dynamically depending upon the tab strip selection.

    Refer this link,

    embed-a-view-into-a-viewcontaineruielement-at-runt

    Regards,

    Sunaina Reddy T

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 29, 2009 at 06:32 AM

    This message was moderated.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 29, 2009 at 07:09 AM

    Hi Ken

    You have to carry out the common 'comment view' in a separate Webdynpro component. This will allow you to embed the view several times on the tab-strip.

    1) Create new Webdynpro component (it's better to use the same DC as for the main Webdynpro component). Copy/paste the Comment view into it. Ensure it's included into Interface View of the component.

    2) Embed the second component into the first one. (On Demand creation mode).

    3) Embed the second component's interface view (with the Comment view) into the each tab.

    You can use the following types of communication between the two components:

    - Via mapped context. The context in interface controller of component A will be mapped to any controller's context of component B.

    - Via interface methods. Interface controller of A will declare some method which will be invoked by component B.

    BR, Sergei

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 27, 2009 at 02:45 PM

    I ended up abstracting out a lot of the data handling code, so the view code was trivial. So I just created a new form for each comment area. Not ideal, but simple.

    Add comment
    10|10000 characters needed characters exceeded