Show hide details below a shape nor re arraging

Dear friends,

iam creating a chart same like below image:
https://forum.nwoods.com/uploads/db3963/original/2X/9/924cfdf77f94f29ec7c73ba7243345d07de6a18e.png

I want to show or hide the below table on each blue color nodes. I manage to show/hide by below code:

function showDetails(e,Obj){
if(Obj.part.data.visible){
diagram.model.setDataProperty(Obj.part.data, “visible”, false);
}else{
diagram.model.setDataProperty(Obj.part.data, “visible”, true);
}
diagram.updateAllTargetBindings();
reArrangeNode(“left”, leftMainNodeInc, centerObjX, centerObjY);
}

its working fine. But I have a function called reArrangeNode, its not working, if I call after doing some action its working pls help me . When I call re arrage function, it will calculate height of the each object and arrage accordingly. even its visible true (shows table) its calculating as old height.

pls help me to solve this… even I put diagram.updateAllTargetBinding() too its not updating…

Thanks and Regards,
Syed Abdul Rahim

Have you tried wrapping it in a transaction?

function showDetails(e, obj) {
  diagram.model.commit(m => {
    m.set(obj.part.data, "visible", !obj.part.data);
    reArrangeNode("left", leftMainNodeInc, centerObjX, centerObjY);
  });
}

Dear Mr.jhardy,

Thanks for the reply. i will try this and get back to u. Pls tell me one more thing… i gave binding like

new go.Binding(“visible”, “visible”),

pls tell me how can i give this as twoway? for example locaiton i used to give like

new go.Binding(“location”, “loc”, go.Point.parse).makeTwoWay(go.Point.stringify)

for locaiton its working how can i make visible two way in order to make effect immediately?

Thanks and Regards,
Syed Abdul Rahim

You probably don’t need it to be TwoWay. A TwoWay Binding just means that when some code sets GraphObject.visible, the value is transferred to the source data object in the model.

It has nothing to do with “immediate effects”.