Adornment inheriting rogue values

So I’m adding a tooltip to my flowchart using similar to this below:

toolTip:
$$(go.Adornment, “Auto”,
$$(go.Shape, { fill: “#FFFFCC” }),
$$(go.TextBlock, { margin: 4 },
new go.Binding(“text”, “showTip”))
)

As you can see, this is bound to the ‘showTip’ in my JSON object.

This works fine for those objects that have the showTip value - however, when I hover over an object with tooltips enabled but no showTip attribute then the previous showTip value is shown. By previous showTip … I mean the previous showTip that was shown on hover.

Scenario:


item1: “showTip”,“value1”
item2:
item3: “showTip”,“value3”


hovering over item 1 shows the correct value.
hovering over item 2 shows the value from item 1
hovering over item 3 shows the correct value.
hovering over item 2 shows the value from item 3

I can force this odd inheritance to not be so apparent in two ways

  1. Make showTip mandatory (not an option)
  2. Force an 'empty' value when no value is added in the JSON object (then renders an empty tooltip box) - "showTip"," "
Is there some way through the API to say 'only use this adornment if the data.showTip has a value'?

I guess the other two options are to create my own ‘tooltip’ attaching a hover event and rendering my own tooltip but I’d rather use OOTB if this can work properly?
Or to create a copy of the object(s) that I want to support tooltips but a none-tooltip version - this feels really really hacky and from an editor perspective would do too.

Thanks

It might be easiest to add a Binding on the whole Adornment:
new go.Binding(“visible”, “”, function(d) { return d.showTip ? true : false; })
This also has the effect of not showing a tooltip if d.showTip is an empty string.

Thanks Walter - this worked a treat.

{
toolTip: // define a tooltip for each node
go.Adornment, “Auto”,
new go.Binding(“visible”, “”, function(d) {
debug(“debug”, ‘showTip:’ + (d.showTip ? d.showTip : ‘doesnt exist’));
return d.showTip ? true : false;
}),
$$(go.Shape, { fill: “#FFFFCC” }),
$$(go.TextBlock, { margin: 4 },
new go.Binding(“text”, “showTip”))
) // end of Adornment
},