Pass Data Between a Fragment and Its Parent Container

Passing data between a fragment and its parent container (say, a page or another container like a different outer fragment) involves enabling fragment variables as required or optional input parameters to the container. It’s also possible to enable the variable to “write back” directly to the container.

Passing Data From a Page (or Outer Container) to a Fragment

When you define fragment variables and enable them as required or optional input parameters, a page or any container that consumes the fragment can provide values for the input parameters. A page, for example, can define or associate its variable to a fragment’s input parameter. This way, a page variable’s value is used as the initial value for the input parameter enabled in the fragment. See Enable Page Variables to Provide Initial Values for a Fragment’s Input Parameters.

When the same page variable’s value changes “mid-cycle”, the updated value is automatically reapplied on the fragment input parameter and an onValueChanged event triggered on the fragment variable.

Passing Data From a Fragment to a Page (or Outer Container)

There are two ways to do this, and the option you choose really depends on your business use case: