Call Component Action

The action module for this action is "vb/action/builtin/callComponentMethodAction". This provides a declarative way to call methods on JET components.

Parameters

Parameter Name Description
component The component on the page. Use the DOM method document.getElementById to locate a JET element/component.

The following deprecated utility methods are provided in the $page scope to get JET components, but will be removed in a future release:

$page.components.byId('myCard')
$page.components.bySelector('#myCompId')

Note:

These two methods will return null if no element is found, or if the element is not part of a JET component.
method The name of the component method to call.
params Array of parameters to pass to the method, if it takes arguments. Primitives, objects, and array parameters are passed by value and not by reference. Instances are still sent as references.

For this sample composite component, the 'flipCard' method takes two parameters: 'model', which is unused (null below), and 'event', which we construct with a 'type' property:

"myActionChain": {
  "root": "myAction",
  "actions": {
    "flipCardMethodCall": {
      "label": "Flip the Card",
      "module": "vb/action/builtin/callComponentMethodAction",
      "parameters": {
        "component": "{{ document.getElementById('myCard') }}",
        "method": "flipCard",
        "params": ["{{ null }}", { "type": "click" }]
       }
     }
   }
}