All I’ve done is what Walter told you: remove the model replacement from your AJAX and replaced it with some boilerplate for updating the dropped nodes, which you’ll probably need to update. In general, we can’t debug your code for you or continually provide you with code specific to your app. I highly suggest you read all the intro pages to become more familiar with GoJS.
// this DiagramEvent is raised when the user has drag-and-dropped something
// from another Diagram (a Palette in this case) into this Diagram
myDiagram.addDiagramListener("ExternalObjectsDropped", function (e) {
// expand any "macros"
myDiagram.commandHandler.ungroupSelection();
// make AJAX request
jQuery.ajax({
type: "GET",
url: '/Home/GetRandomObjectProperties'
}).done(function (data) {
// find the node you want to modify, which will be in the Set myDiagram.selection
var nodedata = myDiagram.selection.first().data; // you may want something else
var properties = data.map(function (item) {
return { "property_name": item.Item1.toString(), "property_value": item.Item2.toString() };
});
myDiagram.model.setDataProperty(nodedata, "properties", properties);
});
myPalette.model = new go.GraphLinksModel([
// a regular nodes
{ key: "B", text: "block B", color: "black" },
{ key: "C", text: "block C", color: "black" },
// a group nodes
{ key: "G", text: "Macro1", isGroup: true },
{ key: "D", text: "Macro2", isGroup: true },
{ category: "circle", key: "Gc", text: "A", color: "black", group: "G", loc: "0 0" },
{
category: "table", key: "Ga", group: "G", loc: "60 0"
},
{ category: "object1", key: "Gd", text: "AAAA", color: "black", group: "D", loc: "0 0" },
{
category: "table", key: "Ge", group: "D", loc: "60 0"
}
], []);