Showing posts with label CCA. Show all posts
Showing posts with label CCA. Show all posts

Tuesday, 30 July 2019

JET - CCA communication with writeback

JET: v6.0.0
Source: GitHub

I found a nice YouTube video (Inter-module Communication with Custom Events) by John Brock, on the topic of inter-module communication in Oracle JET, using the concept of event bubbling.

The above method proposed by John will certainly solve communication problems between two JET modules, between a JET module and a CCA and also between two CCAs, and is thus a highly useful one.

However, there is another quick method to establish connectivity between two JET web components (CCAs), and that is through the writeback feature. This is essentially a quick solution, and works only between CCAs in one page (or module).

The writeback feature essentially means that when a property of a CCA is changed, the changed value is communicated to the component which is hosting the CCA. A crude and high-level process diagram would be something like this:

The app-controller contains an observable, which is a writeback-enabled property of CCA1. When this property is updated on the CCA, the value is also updated on app-controller. The subscription handler of this observable updates a variable on CCA2. The same flow is applied from CCA2 to CCA1.

The above example shows two CCAs placed on the index page of the application. When something is updated on the textbox of CCA1, the same message is displayed in CCA2, and vice versa.