Hi,
Is there any way threw which i can remove label editable field dynamically at run time when any user creates link from one node to another node i just want to remove start and end edge label editable field
using this code i am able to remove the text from label but i am not be able to remove its editable field
var model = myDiagram.model;
model.startTransaction("setProperty");
var data = myDiagram.selection.first().data // get the first node data
model.setDataProperty(data, 'text', '');
model.commitTransaction("setProperty");
It sounds like you want to make part of the Link Template invisible when there’s no text. You can do that with a binding:
Something like:
myDiagram.linkTemplate =
$(go.Link, // the whole link panel
{
...
},
new go.Binding("points").makeTwoWay(),
$(go.Shape, // the link shape
{ strokeWidth: 1.5 }),
$(go.Shape, // the arrowhead
{ toArrow: "standard", stroke: null }),
// link label:
$(go.Panel, "Auto",
$(go.Shape, // the label background, which becomes transparent around the edges
{
...
}),
$(go.TextBlock, "transition", // the label text
{
...
},
// editing the text automatically updates the model data
new go.Binding("text").makeTwoWay()),
new go.Binding('visible', 'text', function(t) { return t !== '' })
) // end Link label
);
Specifically the new go.Binding('visible', 'text', function(t) { return t !== '' }) binding.
Note that this makes it so, if someone edits a label to be empty, the label will disappear and it won’t be possible for the user to get it back, unless you make some way of doing so.