0 votes
852 views
by (21.5k points)

1 Answer

0 votes
by (30.6k points)

Control addressing is the toolkit's way to find a control object from JavaScript by its control id and its position in the coach's view tree, instead of DOM ids (which change per instance). The forms:

  • ${Total} - shorthand (only in control event text and formulas) for page.ui.get("Total"): the first control with id Total on the page.
  • page.ui.get("Section/Total") - path from the coach root through container ids (Horizontal Layout, Section, Tab, custom coach view...).
  • me.ui.get("Total") - search below the current control; me.ui.get("../Total") - go up one container; ../../ two.
  • page.ui.get("Lines[2]/Qty") - index into a repeating container (table row, repeated collapsible panel); me.ui.get("../Qty") inside the same row.
  • page.ui.get("Lines/Qty") without an index returns the first row's control; for all rows iterate page.ui.get("Lines[" + i + "]/Qty") over the length of the bound list.
// examples from a button "Recalculate" placed in the section "Order"
var lines = ${Lines};                                    // table anywhere on the page
for (var i = 0; i < lines.getData().length; i++) {
  var qty = page.ui.get("Lines[" + i + "]/Qty").getData();   // control in row i
}
me.ui.get("../Total").setData(sum);                      // sibling in the same section
page.ui.get("Header/Status").setText("recalculated");   // absolute path

Ids come from the Control Id field of each control (unique within its container, defaults like Text1); give meaningful ids before writing handlers. A custom coach view is a container too: its internal controls are addressed through its id (MyView/Inner), which is why reusable views should address their own children with me / this.ui rather than page.

References

Related questions

0 votes
1 answer 793 views
0 votes
1 answer 710 views
0 votes
1 answer 1.3k views
0 votes
1 answer 722 views
0 votes
1 answer 1.1k views
0 votes
1 answer 1.3k views
0 votes
1 answer 901 views
0 votes
2 answers 3.1k views
0 votes
1 answer 1.5k views
0 votes
1 answer 2.5k views
0 votes
1 answer 2.4k views
0 votes
1 answer 1.3k views

723 questions

807 answers

98 comments

4.9k users

Join BPM Community Discord Channel

Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.
Created by Dosvak LLC
Our Youtube Channel
...