Cannot link to all ports in a table panel

Hi,

I created several ports inside a Table Panel.
There seems to be a bug where only the first two ports are recognized as valid link targets.

I’m using the latest GoJS (1.4.19)

Is this a known bug? I see something about routing to sub elements of TableRows in v1.4.12, maybe it didn’t quite fix things?

It seems to work fine in the http://gojs.net/latest/samples/records.html and http://gojs.net/latest/samples/dynamicPorts.html and http://gojs.net/latest/samples/pipes.html samples.

The bug that you mention only involved the computation of the route when connected with ports inside TableRow or TableColumn Panels. (It might have had to do with clipping, but I don’t remember at this moment.) There was no problem with link validation.

I’ll get a trimmed down example together (drawing it differently now so I can keep going).
Your example is similar but not quite the same to what I have.
I have something like this:

var f_temp1 =
    $(go.Panel, 'TableRow',
        $(go.Panel, 'Auto',
            {column: 0},
            $(go.Shape, 'Rectangle', { fill: 'lightgreen' }),
            $(go.TextBlock, {margin: 5}, new go.Binding('text', 'an', go.Binding.toString)),
            $(go.Shape, 'Ellipse',
                { width: 10, height: 10, fill: 'white', alignment: new go.Spot(0, 0.5) },
                { cursor: 'pointer', toLinkable: true, toMaxLinks:1},
                new go.Binding('portId', 'an', function(x){
                    var r = go.Binding.toString(x);
                    //console.log("  portid " + r);
                    return r;
                }),
                new go.Binding('_data', 'type')
            )),
        $(go.Panel, 'Auto',
            { column: 1 },
            $(go.Shape, 'Rectangle', { fill: 'white' }),
            $(go.TextBlock, {margin: 5}, new go.Binding('text', 'an', go.Binding.toString)))
    );
Maybe it can’t digest a nested auto panel.
The portIds do come out unique, I’ve traced them out.

Nesting “Auto” Panels should work well. But the template you show doesn’t have nested “Auto” Panels anyway.

This might be unrelated to your problem, but why are you binding a new Shape._data property?

As far as the _data field, I’m still learning what GoJS is doing under the covers. (would be easier with normal unminified source of course).

I’m trying to do this:
When a user starts to drag an output port, I want to immediately highlight all ports they are allowed to connect to.
So I do something like this in the onActivate() call back on the linking tool:

  1. iterate over each node
  2. iterate over each port on that node
  3. for each port check it’s “_data.type” to see if I’m allowed to use it
  4. If so, highlight it.

Is there some other way to get to the data element that was used when that itemArray item was being generated? I don’t think there is a “port.data” field available.

I’m cleaning up my earlier work as I learn more. I was going to circle back to this one.

If what you show above is your item template, then port.panel.panel should be the Panel created for the particular item data, and port.panel.panel.data would be that item data value.