cancel
Showing results for 
Search instead for 
Did you mean: 

Navigating between components

Former Member
0 Kudos

Hi,

I have created two WD components. In the "main" component I can produce a list of certain items in a table. Then the user can select a row and click one of the provided buttons. When a button is clicked, the other "detail" component/application should be launched. (I think that this is a typical create/change/display case.)

What is the best way to achieve this?

1) Should I just launch the "detail" application with the needed parameters, or

2) Should I somehow create a new view to the "main" component, and into this view I should then somehow embed the "detail" component? (Then of course navigating between the views is straightforward.)

3) Another alternative?

One important point is that I probably want to be able to return from the detail component to the main component, and then in the main component I should still have the same data in the table as before accessing the detail view (and preferably the same selected row in the table).

Regards,

Pa

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Is there a specific reason for splitting the views between 2 different components? You would want to do it only in an event where the 'detail' view is reused by other components. Else the simplest would be to create both the views within the same component. I know you would have that of it, but just wanted to make sure

If its indeed necessary that you would want the 2 views in different components, and you would want cross navigation between the views, then the best way is the second option you have pointed out

There are 2 parts to this:

1) To embed the detail view from Component B to the view in the main Component.

This is achieved via the concept of Component Sharing

You could define a back navigation button in this view, so that you need not worry about state of the List view being unaffected by the backward navigation. The state of the list view in main Component will be retained since the context values have not changed and the back button.

2) Pass values from Main Component to populate values in the detail View. (this is achieved by defining either the nodes which are used to populate the detail view as interface nodes and by populating these nodes in main Component. Or to define an interface method in the Component B whcih will populate the nodes to display detailed view and this interface method could be called from Main Component on selection of the row in the items list

A couple of things to note here would be:

If there are any events that are trigerred in the detailed View from component B, and if that information needs to be passed back to main Component , then an interface event needs to be defined in the Component Controller B, which is fired when the event is trigerred. In the List view controller in the main Component, an Event handler method needs to be defined which listens to the interface event fired.

Hope this helps

Best Regards,

Rashmi.

Former Member
0 Kudos

Thanks Rashmi,

Now thinking afterwards, we could have added this detail component as a separate view to the main component. Basically we will reuse this other component, but we could have done it also in this way. Anyhow, now it is a bit too much work to create the same functionality into this new view (the detail component is actually quite complex - much more complex than the main component).

I think I will try the component sharing approach. I should be already familiar with it at least in some level, since I have used ALV component in some other development.

regards,

Pa