findElementByKey method
findElementByKey([queryString])
queryString
Stringreturns
Objectid
Stringkey
Keytype
StringdomNode
DOM Nodeproperties
Object[]composition?
Objectpoints?
ObjectisClosed?
BooleanautoSqueeze?
BooleanautoSize?
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");