I am trying to add a URL for every item in the example - Entity Relationship
The aim is to click an item, such as ProductID under Products, and open a new page, based on the URL.
I tried to update the TextBlock with a click function -
$(go.TextBlock,
{
stroke: "#333333",
font: "bold 14px sans-serif",
wrap: go.TextBlock.WrapFit,
editable: false,
click: function(e, obj) {
var itemData = obj.part.data;
window.open(itemData.url, "_blank");
},
},
However, it always opens a blank page. I feel I am missing something in referring to the URL in the item, and end up referring to the url in the node itself.
I have updated the nodeDataArray as -
var nodeDataArray = [
{
key: "Products",
items: [{ name: "ProductID", iskey: true, figure: "Decision", color: colors.red, url: "https://www.example.com/product"},
{ name: "ProductName", iskey: false, figure: "Hexagon", color: colors.blue url: "https://www.example.com/productname"},
{ name: "SupplierID", iskey: false, figure: "Decision", color: "purple" , url: "https://www.example.com/supplierID"},
{ name: "CategoryID", iskey: false, figure: "Decision", color: "purple" , url: "https://www.example.com/categoryID"}]
}, ...