cancel
Showing results for 
Search instead for 
Did you mean: 

WDA cross component communication

christophnagy
Explorer
0 Kudos

Dear Experts,

I'm using two components

Comp1 creates and instance of Comp2 in WDOINIT and passed over the assistance class

Comp1 hold the main contexts used in my application. Now Comp1 calls a dialog (Window > View) from Comp2. Comp1 is calling a method in Comp2 passing the key values needed to built the contexts used within Comp2. Now I struggle with invalidating the contexts that reside in Comp1 after Comp2 has performed changes that impact the display of Comp1.

I also tried to map the corresponding contexts via Interface Mapping from Comp1 into Comp2 and invalidate it there but without success. It seem that a new instance of Comp1 is created all the time I'm trying to access it.

Do you have a best practice approach for me that can be used in general to share data between components and keep the data in sync? If feasible, I would like to use an approach that also triggers a supply function to refresh the "global"-context?

Thanks in advance.

Christoph

Accepted Solutions (0)

Answers (2)

Answers (2)

pokrakam
Active Contributor

Hi Christoph,

"I also tried to map the corresponding contexts via Interface Mapping from Comp1 into Comp2 and invalidate it there but without success. It seem that a new instance of Comp1 is created all the time I'm trying to access it."

As far as I know this is the 'correct' way, but I don't fully understand what you mean by new instance of Comp1? You map the nodes and then update Comp2's elements within Comp2. Changes should automatically apply within Comp1 (internally, mapped nodes point to the same data).

Regards,
Mike

christophnagy
Explorer
0 Kudos

Hi Mike,

thanks for your reply. Whenever I trigger the invalidate of context in comp2 which originates from comp1 I see no effect. Now I have implemented a dirty workaround. I transfer the comp_controller refrence from comp1 to comp2 and make use of get_api().

Regards,

Christoph

pokrakam
Active Contributor
0 Kudos

If it works, why not 🙂

I wasn't 100% sure if an invalidate would propagate back, bit surprised that it doesn't. Another fallback solution is to have a flag attribute somewhere in the context.