OK, so this is possibly a fundamental understanding epic fail…
I have a chart based on the finite state machine sample, and the model used to represent states and transitions (nodes and links) is owned by the parent control, i.e. not copied. This allows easy two way bindings, and as a node is edited on-screen the underlying property is updated.
Now, if I use Angular2 (as an example) to bind a ‘text’ property on a ‘state’ to the UI, when the UI updates it, the corresponding model value is updated but changes are not reflected.
OK, so I have to use startTransaction(), setDataProperty(), commitTransaction() to inform the component that changes have been made, and this works… almost. The issue is that because the model has already been updated, calling setDataProperty with the same value is ignored, and the diagram doesn’t update.
Obviously I could rework the whole data concept to bind the UI to a copy of the workflow, and use a diff to move over modified properties to a GoJs owned copy, but this is a lot of effort to go to.
A workaround for now is
this._gojsModel.startTransaction("edit"); this._gojsModel.setDataProperty(data, property, ''); this._gojsModel.setDataProperty(data, property, value); this._gojsModel.commitTransaction("edit");
What would be a suggested way of providing two-way binding to a selected node? Is there a concept similar to
this._gojsModel.triggerDataPropertyUpdated(data, property); ?