Hi everybody!
I just have the problem that I have two different web dynpro components and I need a data exchange between this two components after an event fired on one of those.
Is it the correct way to do that over the model? Or is it better to send the data with an event? One thing I have to think about that in future more components can be developed who needs this data. How can I do that best?
Bye Markus
Well, it's a topic for tutorial what is a better option, but anyway some guidelines:
1. If you are sharing fairly large amount of data you need context mapping between components (as opposite to passing data via plug/event arguments)
2. If you need to perform visual navigation use plugs but avoid navigation via plugs where eventing is more suitable (notifications this doesn't lead to layout changes). WD Navigation has some nitty-gritty details these could surprise you when you try to apply it as eventing mechanism (rules when plug event handler is called is quite restrictive).
3. Use eventing from embedded components to achieve decoupling.
4. Use to define WebDynpro component interfaces for your components and refer to interfaces from embedder rather to concrete components. The benefits besides obvious decoupling include modularity & improved build time. You can define interfaces in one DC, embedder in other one, and split all your implementations among several others DC (grouping in this case is completely up to you -- by use case, by business objects to process, etc)
Hope this helps,
VS
Hi Markus,
since you fire an event already, i suggest to transport the data via the event. This has the positive side effect of achieving a more loose coupling between the components as by context mapping. You could create a component C, which acts as a listener to the event firing component A and transports the received data to component B (and B2, B3...). Using this scenario, only C knows something about A and Bx while A and Bx are totally decoupled.
On the other hand, you have to do some more manual programming to transport the data from C to the receiving components. Well, it's like always, what you like most is what's fitting best 😉
Hope that helps.
Regards
Stefan
Add a comment