cancel
Showing results for 
Search instead for 
Did you mean: 

Cross-component: Call method of using component from within used component?

Former Member
0 Kudos

Hi,

I began diving into cross-component programming.

Meanwhile after having digged into some scenarios some questions came up to my mind that I am not able to answer myself. I would appreciate your help here!

Say we have to components. Comp A uses Comp B (hence, B is a component usage in A)

1) How to make them communicate not on a data level (via context binding) but on a process level, thus...

a) can I call A's method from within B? How is the approach on a general level? - as B can be used from totally different components (like A, A1, A2 ...)

b) perhaps the only way to do this is by firing events? If so, how can I react in A when an event in B (marked as interface event) gets fired? As it seems they do not get registered within A directly...

I guess the question seems to be a bit tricky. Nevertheless, I think there will be plenty of you out there who used to asked them the same questions before and came up with an approach. Would be nice to hear from you.

Best wishes,

Marc @sap1

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

thanks for your reply!

Indeed, I think the nature of WDA would be just to somehow map the context from the used component to the other back and forth.

Nevertheless, what if I would like to invoke a method of the using component from inside the used component.

One sample for this requirement could be e.g.:

Component B offers a tree item and a send/verify button.

Component A uses B and has some restraints regarding what the selection should look like.

The user taps the button in B (at runtime in the view container of A), the context gets updated in A and B and in Component A the verifyWithOwnConstraints() method gets called (through B).

Thanks again,

Marc

Former Member
0 Kudos

Hi Marc

You are trying to use component B in component A. then all the methods of component B which are defined in the interface controller can be accessed in component A.

if you go to methods tab in component A then you can select the event of component B as triggerence for method of component A.but in the properties tab the component B should be used as a used component.

Regards

Naresh

Former Member
0 Kudos

Generally i would go for cross component only when i have some common component having common methods, context to be used in multiple components. In your case you do not want to share context data but want to access methods.

Can you please elaborate, what kind of requirement do you have that you want to access a method but not the context, and if the method is not dealing with any context, then why are you going for cross component architecture?

can you clear the real picture?

Best Regards, Amol