Find parent container

Hi,

I have a table panel where users can drop item from a palette.
This is the table definition.
var tableTemplate =
$$(go.Node, "Auto",
{
[...]
},
$$(go.Panel, "Vertical",
[...]
$$(go.Panel, "Auto",
$$(go.Shape, "Rectangle", // the border
{ fill: "transparent", stroke: "black" }),
$$(go.Panel, "Table",
{
name: "TABLE",
[...]
},
$$(go.Panel, "TableRow",
{
row: 0
},
$$(go.Panel, "Table",
{
name: "HEADERTABLE",
column: 0,
[...]
),
$$(go.Panel, "Table",
{
name: "CONTENTTABLE",
column: 1,

)
),// end table row
) // end Table Panel of items
) // end Vertical Panel
)
); // end Node
When user drops an item into 'CONTENTTABLE' I would like to add also a textblock in the same 'HEADERTABLE'. I tried to do this in the mouseDrop event of the 'CONTENTTABLE' and to search for the sibling table (HEADERTABLE) with an iterator of all diagram nodes, but obviously I don't know wich is the current table.
I also tried using a 'findObjectsAt' passing diagram.lastInput.documentPoint as first parameter but also in this case I cannot find the right table.
I could also try to udate model data but I don't know the current node key of the containing item.
Can you please suggest me the right way to do this?
Many thanks.
Andre

Have you data bound Panel.itemArray? I ask because that would be the normal thing to do when there is a variable number of elements in a panel. But when you do bind Panel.itemArray you would want to specify the Panel.itemTemplate (or .itemTemplateMap), which you do not seem to be doing.

As an example of binding Panel.itemArray and supporting drag-and-drop onto such lists of items, see http://gojs.net/latest/samples/dragDropFields.html

Yes,

I've binded each table to an itemArray and I have also the itemTemplate.
I've put only few info just to describe the main part of the table-template that I'm using.
When I drop an item into CONTENTTABLE I add an item into the data array:
diagram.model.addArrayItem(graphObject.itemArray, newItem);
And I'm trying to add also an item to the other table inside the mousedrop event of CONTENTTABLE , but I can't find a way to do that in the same event (i.e.find the other graphObject related to HEADERTABLE).
Andre

The second argument to the mouseDrop event handler is the object where that property is defined. So if you have set the “CONTENTTABLE” Panel’s mouseDrop property, the second argument will be that Panel.

If that second argument is named “obj”, then obj.panel.findObject(“HEADERTABLE”) will return what I think you want.

Great, exactly what I was looking for!

Many Thanks Walter!