How to findObject by name when using itemTemplate

How to findObject by name when using itemArray.
itemArray will have nested panel.

Is there a way to get findObject by name when using itemArray.

Because item templates can have names on their GraphObjects, it means a Panel with a non-null Panel.itemArray would have many elements with the same name within their visual tree. Therefore the scope of names and thus the scope of Panel.findObject stops when coming to a panel that was copied from an item template.

If you want to find an object by name within an instantiation of an item template, you first have to find the desired item panel and then call Panel.findObject on it.

To find a particular item panel, you can use Panel methods such as elt or findItemPanelForData.

Trying to access data
node
|
V
panel
|
V
panel
|
V
Panel - name = ‘test1’ this panel has new go.Binding(‘itemArray’, ‘configDetails’), (itemtemplate) {
|
V
Panel = dynamic name (P1001, P2002) given to this panel but not able to
access
|
V

   Panel
    |
    V
   this panel has  new go.Binding('itemArray', 'items'), (itemtemplate) --> need to 
       access items inside this

}

Iam able to get the part with name ‘test1’ but not able to get to panels beyond this

test(data){
const node = this.model.findNodeDataForKey(data[0].key);
if (node !== null) {
const nd = this.findNodeForData(node);
const getData = (part: go.ObjectData) => {
if (part) {
const a = part.findObject(‘test1’);
if (!a) {
getData(part.part);
}
else {
console.log(“part”, part);
// not able to access inside this ‘test1’
}
}

  };      
  nd?.part && getData(nd.part);

}

What’s the GraphObject.name of the Panel with the Binding of Panel.itemArray to the data property “items”? Well, for now I’ll assume its named “ITEMS”.

const node = myDiagram.findNodeForKey(...);
if (!node) return;
const test1 = node.findObject("test1");
if (!test1) return;
// Now choose a particular item panel -- either:
const itemPanel = test1.elt(???);
// or:
const itemPanel = test1.findItemPanelForData(???);
if (!itemPanel) return;
const items = itemPanel.findObject("ITEMS");
if (!items) return;
// Now do whatever you need with this Panel --
// probably call elt or findItemPanelForData

i get the value for test1

however itemPanel is null if i use test1.elt(‘P1001’) or test1.findItemPanelForData(‘P1001’)
where P1001, P2001 are the names given to the panel dynamically (for each item in itemArray)

Panel.elt takes an integer index as an argument, not a string. Panel | GoJS API

Panel.findItemPanelForData takes a JavaScript data Object as an argument, not a string. Panel | GoJS API