Hi Walter. I’m trying to do same.
We spoke about it yesterday in here: model.toJson saving issue - #3 by tantum I did what I need but something was certainly missing.
When I edit a TextBlock by clicking it, the “type” value was changing in Image 1 (this is the jsonNodes variable in the code block). But the node was losing it’s shape because that changed “type” value also needs to assigned as “name” in Image 2 (and this is jsonTemplates). “type” in the image 1 has to have the same value with “name” in the image 2. Click-editing on the node only changes “type”. When that two variables have the same value, shape is being displayed on the diagram with no problem.
So I did this:
ivrDiagram.addDiagramListener("ObjectDoubleClicked",
function (e) {
var selectedNode = e.subject.part;
if (!(selectedNode instanceof go.Link)) {
for (var i = 0; i < jsonTemplates.length; i++) {
for (var j = 0; j < jsonNodes.nodeDataArray.length; j++) {
if (jsonTemplates[i].id === jsonNodes.nodeDataArray[j].key) {
jsonTemplates[i].name = jsonNodes.nodeDataArray[j].type;
console.log(jsonTemplates[i].name)
console.log(jsonNodes.nodeDataArray[j].type)
}
}
}
}
})
When I double click on the node, it supposed to reassign the “name” value in the jsonTemplates same as “type” in jsonNodes. As you can see I also can that they have the same value on the console.
But still, even when the “type” and “name” have the same value the shape is missing.
Any thoughts to fix this?
Thanks in advance,
Best regards.