How to connect elements of the synoptic with gadgets?

 

Sending a filter

For which we will add we will add to the click event of an element the code

vm.sendFilter(field, value, operator)

We will create a connection with a gadget for which

Click on

and we establish the connection with the gadget. In the Source field we will put the value of the field that we put in vm.sendFIlter and in the target the field of the datasource of the gadget on which we want to filter

Before clicking on our gadget bring all the records

After pressing only for the year 2000

Sending a value

In this example, we sent a json just to display it from the gadget with an alert, but we could use the information from this json to interact with the gadget, defining specific behaviors based on the value received.

In this case we assign the function click event of the element

vm.sendValue ('topic', value) for the example the value is a json object.

The topic in this case we have put ‘event’, but it could be any word or number that allows us to differentiate it from other topics that are used in the same synoptic

We add the link between the synoptic and the gadget using the topic in both the source Field and the target Field

In the gadget we have the function vm.receiveValue, there we will receive as a parameter the values sent from the synoptic, for the example how a json is sent, I transform it to a chain and I show it with an alert to verify that the information is arriving correctly.

When pressing the circle we see that it launches the alert showing us the information.

Â