Place a node(object) left corner of each row of nodes created with TreeModel

Dear Friends,

I have created a tree model, when a button clicked, it will add set of nodes as row below each top node. its working fine. After adding row of nodes below the parent, I want to add another new node to left corner of each row of nodes places.

iam using below code to generate row of nodes below a parent.

function addControl() {
diagram.model.startTransaction(“test1”);
mainCtrlInc++;

var subObjNum = Math.pow(2,mainCtrlInc);
if(mainCtrlInc==1){
    diagram.model.addNodeData({ key: "out_1_1", category: "successRectangle", parent:"e1",text:"out_1_1", uid:"0", visible:true});
    diagram.model.addNodeData({ key: "out_1_2", category: "failureRectangle", parent:"e1",text:"out_1_2", uid:"0", visible:true});
}else{
    var curSubNo = 0;
    for(var inc1 = 1; inc1<=subObjNum/2;inc1++){
      curSubNo++;
      diagram.model.addNodeData({ key: "out_"+mainCtrlInc+"_"+curSubNo, category: "successRectangle", parent:"out_"+(mainCtrlInc-1)+"_"+inc1,text:"out_"+mainCtrlInc+"_"+curSubNo, uid:"0", visible:true});
      curSubNo++;
      diagram.model.addNodeData({ key: "out_"+mainCtrlInc+"_"+curSubNo, category: "failureRectangle", parent:"out_"+(mainCtrlInc-1)+"_"+inc1,text:"out_"+mainCtrlInc+"_"+curSubNo, uid:"0", visible:true});
    }

}
diagram.model.commitTransaction("test1");
diagram.updateAllTargetBindings();

**//Adding new node - I want to place this left corner of each row (current)**
var curLineObj = diagram.findNodeForKey("out_"+mainCtrlInc+"_1");
var p = { x: curLineObj.actualBounds.x - 300, y: curLineObj.actualBounds.y };
diagram.model.addNodeData({ key: "C_" + mainCtrlInc, category: "controlRectangle", text: "C" + mainCtrlInc, movable: true});

}

adding new node left corner of each row not working. I want to place that new node left corner of each row. same x-300, y of first node in the row

in this model, my new node going below the row instead of left side of row.

please help me friends.
Thanks and Regards,
Syed Abdul Rahim

Could you please show two small screenshots, showing before and after adding that one node? Plus one small screenshot or an annotation on the second screenshot for where you want the new node to be instead of where it is?

Also, did you want to use TriangleLayout? Arrange nodes in pyramid or pascal triangle pattern - #3 by walter

Iam getting like


I want like this

Pls tell me when i click & open and close it is getting adjust automatically. I want to prevent it
Pls tell me the way to prevent auto position


Refer these pics. If i close & open each table in node its adjusting automatically. I want to prevent it.

Any help friends? Pls tell me i have to use tree model or graphic model?

This discusses when layouts happen and how to control it: GoJS Layouts -- Northwoods Software

How have you defined your Diagram.layout?

i used the layout as below, if i missed something pls correct me to solve the issues:

diagram.layout = $$(go.TreeLayout, { angle: 90 });

diagram.model = new go.TreeModel(nodeDataArray);

Reading GoJS Layouts -- Northwoods Software will give you the answer to your question: set isOngoing to false.

i set isONgoing = false, but still iam getting same out put as below when i add new node without parent.

https://forum.nwoods.com/uploads/db3963/original/2X/4/4603999904a306f1e0696f17b17c65313f2d102d.jpeg

i want like below pic:

https://forum.nwoods.com/uploads/db3963/original/2X/0/074ec7b6f09ade1280234d6d2488f4be455f8d38.jpeg

i want to place the all in same line but c1,2,3 nodes without parent…

Thanks Mr.Walter.

Please tell me in the below diagram (iam using tree model),
https://forum.nwoods.com/uploads/db3963/original/2X/0/074ec7b6f09ade1280234d6d2488f4be455f8d38.jpeg

if I want to change a particular links (may be set of links) color and thickness is it possible? pls tell me how can I change that particular set of links color and thickness.

Thanks and Regards,
Syed Abdul Rahim

That is a completely different topic that deserves its own forum topic. But the answer is to use data binding: GoJS Data Binding -- Northwoods Software

Back to this topic – so did setting Layout.isOngoing to false prevent the automatic layouts that were moving nodes away from where the user had moved nodes manually? Or is the problem more complex than that?

Dear Mr.Walter,

Greetings! thks for the answer, S, isOngoing:false is doing the job. its working fine. Sure I will open a new forum for this.

Thanks and Regards,
Syed Abdul Rahim