cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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!

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

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.

siarhei_pisarenka3
Active Contributor
0 Kudos

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

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi,

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

Refer this link,

Regards,

Sunaina Reddy T

Former Member
0 Kudos

Hi Ken,

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

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