Hi dear developers.
I have any questions:
the first - I use next code for creating textLabels in node:
diagram.nodeTemplate =
$(go.Node, "Auto",
$(go.Shape, "RoundedRectangle",
{ fill: "#3AA7A3" }),
$(go.Panel, "Vertical",
new go.Binding("itemArray", "items"),
{
itemTemplate:
$(go.Panel, "Auto",
{ margin: 2 },
$(go.Shape, "RoundedRectangle",
{ fill: "#91E3E0" }),
$(go.TextBlock, new go.Binding("text", ""),
{ margin: 2 })
) // end of itemTemplate
})
);
diagram.model =
$(go.GraphLinksModel,
{
nodeDataArray: [
{ key: 1, items: [ "Alpha", "Beta", "Gamma", "Delta" ] },
{ key: 2, items: [ "first", "second", "third" ] }
],
linkDataArray: [
{ from: 1, to: 2 }
]
}
);
the code from example.
Can I use the following data model and if I can, how, to show all values from dataModel?
diagram.model =
$(go.GraphLinksModel,
{
nodeDataArray: [
{ key: 1, items: {key1:[[propertyName:'FirstName',value:'Green'], [propertyName:'SecondName',value:'Bob'],key2:[[propertyName:'FirstName',value:'Broun'], [propertyName:'SecondName',value:'Kate']} }
],
linkDataArray: [
]
}
);
The second one to dropout node from group I use next code
function finishDrop(e, grp) {
var ok = (grp !== null
? grp.addMembers(grp.diagram.selection, true)
: e.diagram.commandHandler.addTopLevelParts(e.diagram.selection, true));
if (!ok) e.diagram.currentTool.doCancel();
}
myDiagram =
$(go.Diagram, "myDiagramDiv",
{
// when a drag-drop occurs in the Diagram's background, make it a top-level node
mouseDrop: function(e) { finishDrop(e, null); },
layout: // Diagram has simple horizontal layout
$(go.GridLayout,
{ wrappingWidth: Infinity, alignment: go.GridLayout.Position, cellSize: new go.Size(1, 1) }),
"commandHandler.archetypeGroupData": { isGroup: true, text: "Group", horiz: false },
"undoManager.isEnabled": true
});
$(go.Group, "Auto",
{
background: "transparent",
ungroupable: true,
// highlight when dragging into the Group
mouseDragEnter: function(e, grp, prev) { highlightGroup(e, grp, true); },
mouseDragLeave: function(e, grp, next) { highlightGroup(e, grp, false); },
computesBoundsAfterDrag: true,
// when the selection is dropped into a Group, add the selected Parts into that Group;
// if it fails, cancel the tool, rolling back any changes
mouseDrop: finishDrop,
handlesDragDropForMembers: true, // don't need to define handlers on member Nodes and Links
// Groups containing Groups lay out their members horizontally
layout: makeLayout(false)
}
how a can catch group when I dropout node from it. I wanna get all links its group and create its to droping node