Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

How to use DiagramModel.Modifiable property

$
0
0

@necap wrote:

Hi,
I am trying to make the sample https://gojs.net/latest/samples/sequentialFunction.html non editable. Actually what I want is for the user to be unable to delete or add nodes/links but the hecan still movel the nodes around.

With this I can make the cart absolutely readonly, but then I cannot drag the nodes:

$(go.Diagram, "myDiagramDiv", // must be the ID or reference to an HTML DIV
{
// start everything in the middle of the viewport
initialContentAlignment: go.Spot.Center,
isReadOnly: true,
"clickCreatingTool.archetypeNodeData": { "key":"t6", "category":"new_thingy", "text":"my transition 6"},
layout: $(go.LayeredDigraphLayout, { direction: 90, layerSpacing: 10, setsPortSpots: false }),
"undoManager.isEnabled": true // enable undo & redo
});
I did read in https://forum.nwoods.com/t/partial-readonly/3782 that I could achieve what I am looking for by setting DiagramModel.Modifiable to false.

So I am trying to set that property, but I get either a Javascript error, or I get no error but still I can delete nodes. I have tried stuff like this:

function load() {
myDiagram.model = go.Model.fromJson(document.getElementById("mySavedModel").value);
myDiagram.Modifiable = false;
}

or this:

function load() {
myDiagram.model = go.Model.fromJson(document.getElementById("mySavedModel").value);
myDiagram.DiagramModel.Modifiable = false;
}

... and other combinations to not avail.

Please, could you tell me how could I set that property so that the user can move around nodes, bot not delete them?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles