Docs

API

findElementByKey method

findElementByKey([queryString])

  • queryString String
  • returns Object
    • id String
    • key Key
    • type String
    • domNode DOM Node
    • properties Object[]
    • composition? Object
    • points? Object
    • isClosed? Boolean
    • autoSqueeze? Boolean
    • autoSize? Boolean

Description

Method returns an object by it's ID containing DOM node reference, type and other properties.

Action example

const color = this.findElementByKey("homeTeamColor");
color.domNode.style.backgroundColor = "red";
color.domNode.innerHTML = "Example inner HTML";

Nested compositions

Accessing elements of the nested compositions is simple and all it requires is passing a composition kely and a comma. After comma you can reference any element within that composition.

const playerOneOnField = this.findElementByKey("_fieldComposition._player1");
const playerTwoOnField = this.findElementByKey("_fieldComposition._player2");