Set property 'isModified' does not work

problem of ‘setDataProperty’ and ‘isModified’. I do:

  1. I used the method of ‘setDataProperty’ to set model data
  2. then the Diagram.isModified is changed to true
  3. I set the Property of ‘isModified’ false
  4. but it does not work , I consoled the property of ‘isModified’ is also true

I want to change the property and raise the listener of ‘Diagram.addDiagramListenr(‘modified’)’ after I set the Property of ‘isModified’.what can I change the property of ‘isModified’ to false success after I used the method of ‘setDataProperty’?

Thank you very much!

I’ve read the linked that have same question as I did.Thank you! But I still don’t understand.

By your reply, do you mean that this property can only be changed automatically?

I read the GoJs document about diagram.isModified, it is saying “set this property can raise the “Modified” DiagramEvent, although perhaps not immediately.” So I understand is that it can be changed by developer.

So what I need do to change this property to false and raise the “Modified”[DiagramEvent]

Thank you very much !

From that earlier topic, myDiagram.isModified - #2 by walter :

As long as a transaction is ongoing or an undo has been done, .isModified will be true. When the transaction is completed or it is fully redone, .isModified will automatically become false.

Also, from Diagram | GoJS API :

Gets or sets whether this Diagram’s state has been modified. Setting this property does not notify about any changed event, but it does raise the “Modified” DiagramEvent, although perhaps not immediately.

Returns true if the Diagram has been changed, if the undoManager has recorded any changes, or if an undo has been performed without a corresponding redo.

Replacing the model automatically sets this property to false after the initial layout has completed. The “Modified” DiagramEvent is also raised when an undo or a redo has finished. A “Modified” DiagramEvent listener must not modify this Diagram or its Model.

Whenever you make changes to the model, you must do so within a transaction. Did you do so?

However, I think you can set the Diagram.isModified property at any time, since it isn’t really part of the model or diagram state – it’s more of a “meta-property”.