I want to a reverse link which is drawn between two scrollingtable


A link is drawn between two scrollingtables(each table contains some row). Now which ever last link is drawn i want to reverse link property.

Example: we have two table A and B. each table contains some rows( let say A contains a1, a2, a3 and similar for table B).

So i drawn first link from A.a1 to B.b1.
And i drawn second link from B.b2 to A.a2. but now i want to reverse second link.

So i am using LinkDrawn event to make changes.
i am exchanging property value between to and from, toPort and fromPort
But i am not able to reverse the link.

Please help me. where i am lacking?

Are you updating the model? Within your LinkDrawn handler, you probably want to call myDiagram.model.setDataProperty(linkdata, "from", oldFrom) and the same for the other properties.

@jhardy Yes. i am updating model using myDiagram.model.setProperty() in LinkDrawn handler. but this is not working in case of scrolling. it may be i am missing some properties to update.

I tried by following cases

case 1. exchange from and to properties.

case 2. exchange from and to properties. And exchange fromPort and toPort.

case 3. exchange from and to properties. And exchange fromPortId and toPortId.

but it is not working.

Can i get information. what are necessary properties should be change for reversing link ( if link is drawn from Alpha.A1 to Beta.Aa1 then reverse means draw it from Beta.Aa1 to Alpha.A1 programatically - by changing its properties ).

I am using sample example of ScrollingTable.

You want the 2nd.

function swapLink(e) {
  var linkdata = e.subject.data;
  var oldFrom = linkdata.from;
  var oldFromPort = linkdata.fromPort;
  var oldTo = linkdata.to;
  var oldToPort = linkdata.toPort;
  myDiagram.model.setDataProperty(linkdata, "from", oldTo);
  myDiagram.model.setDataProperty(linkdata, "fromPort", oldToPort);
  myDiagram.model.setDataProperty(linkdata, "to", oldFrom);
  myDiagram.model.setDataProperty(linkdata, "toPort", oldFromPort);