Hi All,
I’ve been trying to set up a double click function that creates a popup that allows a user to view and update a node/group properties. I’ve created a Double Click listener and using the htmlinteraction example as a reference I can see how to access elements text/shape etc.
If I can access the main object components of an element with elem (via e.diagram.selection) - "SHAP’ or “TEXT”…
-
How can I access the properties of the element? In this case a property called prop1, below I try findObject but I/m guessing it’s a property as opposed to an object.
-
How do I write/update the property of the selected node/group?
Thanks,
Z
// Double Click
var info = document.getElementById("myInfo");
myDiagram.addDiagramListener("ObjectDoubleClicked", function (e) {
var sel = e.diagram.selection;
var str = "";
if (sel.count === 0) {
str = "Selecting nodes in the main Diagram will display information here.";
info.innerHTML = str;
return;
} else if (sel.count > 1) {
str = sel.count + " objects selected.";
info.innerHTML = str;
return;
}
var elem = sel.first();
var shape = elem.findObject("SHAPE");
var txtblock = elem.findObject("TEXT");
var propy1 = elem.findObject("prop1"); //doesn't read prop1 property of selected object
alert("display " + txtblock.text + " " + propy1); //null because is empty
});