How to access prespective components within an embedded view from script

Hi,
I have a view A with EmbeddedView component with another view B. F.P, CYANIDE and SULFIDE are embedded views.

View B has two fields: checkbox and Number Field.

I want to know:

  1. How to get values from this embedded view, when saving the form.
  2. How to pupulate this embedded view’s field when form is opened for edit. This is initiated by:
    system.perspective.navigate(view=viewA, params=params)

Multiple clients might be working with this form simultaneously. Multiple forms A can be openned to edit different instances.

Any help will be appreciated!
Thanks!

There are several different ways to get values from within en Embedded View. The two following methods are the most common, useful, and easy to maintain:

1. Using View params:

  • The View itself needs to have params in place. In the Project Browser, click the View node of the View which you will be embedding (View B).

  • Locate the params category and make a new param value (or an object which contains relevant param values) and click the arrows to the right of the value until the arrows point both ways (bidirectional).

  • Bind the components with values you need to access to the relevant param values, and make sure the bindings are also bidirectional.

  • In View A, specify viewParams which match the keys you specified in View B.

  • Screen Shot 2020-11-18 at 4.22.56PM

Now, you can bind against EmbeddedView.props.viewParams.value_bool to obtain the value of the checkbox in the embedded view.

2. Messaging

  • In View B, select the checkbox, and right click Checkbox.props.selected.
  • Select “Add Change Script”.
  • Supply the following code:
system.perspective.sendMessage('CHECKBOXCHANGE', payload={'value': currentValue.value}, scope='page')
  • In View A, on the Embedded View component itself, set up a custom property named value_bool.
  • Now right-click the Embedded View component and select “Configure Scripts”.
  • Double-click “Add Handler”.
  • Supply “CHECKBOXCHANGE” for the Handler name.
  • Make sure the scope checkbox for “page” is selected.
  • Supply the following script here:
self.custom.value_bool = payload['value']

Repeat these steps for the Numeric Entry Field.

Thanks!

Hi,
If I want checkbox as a view in the table column then how can I achieve this bcoz if render: boolean and boolean prop: checkbox are selected then need to click 2times to select the checkbox in the table column …is there any solution for this ?If I select render as view and viewpath of checkbox(created in separate view) then it is not returning any value by clicking on checkbox column…
on render boolean…oneditcellcommit …it is returning value as true/false based on select/deselect but the issue is one click to enable the edit cell then it is allowing to select/deselect the checkbox …which is not acceptable…
image