How do I dynamically change the fromSide or toSide value?

How do I dynamically change the fromSide or toSide value when an item is moved without fixing the direction of the connecting line?

You may try to use the update() methof of the dataCollection:

to update the properties of the item.
Like:
https://snippet.dhtmlx.com/t1mgihrp