cancel
Showing results for 
Search instead for 
Did you mean: 

Component initialization in navigation

Former Member
0 Kudos

Hello,

I have two views in my component: A and B.

View A is a "normal" view. Into view B I have embedded another component. The idea is that I can choose certain item in view A, and then navigate to view B, which shows me the details of the selected item.

Now this works in the following way: When I select the item in view A, I populate a certain contect node with the "key fields" of the item, deliver this node to the other component via interface node, and then in the WDDOINIT method of componen B I populate the context with the details based on the key fields in the interface node.

Now the problem is that when I navigate back to view A, and select another item, and navigate again to B, the WDDOINIT method is not triggered anymore, and because of this, I still have the old data there. (=the view is showing me the data of the item that I selected the first time).

How to handle this situation? Can I somehow kill the custom controller (now containing the context with the details) of the component in view B? Or can I call the method, that fills the context with the details, in some other phase than WDDOINIT?

Regards,

Karri

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

In such situations where the second view's content depend on first one.

One should always code in HandleInput method (The input plug method of second view).

This will always provide u with the current data and will remove the dependence on the WDDOINIT.

Common data which is used can be declared as attributes in Component controller.

I hope it helps.

Please revert back with issuse.

Regards,

Sumit Oberoi

Former Member
0 Kudos

Thank you Sumit. The inbound plug handler method seems to be an answer for my question.

Using the attributes of the component controller as common data is something I never thought before. Why would you use attributes instead of sharing a context? Is there some advantages?

Regards,

Karri

Former Member
0 Kudos

Hi,

Mapping the context is the bes option always.

But, if u have sm flag( for visibility etc) then you can use global attributes.

Regards,

Sumit Oberoi

alejandro_bindi
Active Contributor
0 Kudos

As a general rule, the context should only be used to store data that is to be shown on views.

There's no point in storing a big set of data in the context if it can be stored as an internal table controller's attribute instead, both because it's faster and more easily accesible from code.

Former Member
0 Kudos

Alejandro, that is a good rule! Many times context seems to be overly-complicated due to bad design.

Regards,

Karri

Answers (0)