Temporarily blocking changes in the diagram


I am implementing “auto save” when there are changes to the diagram. Basically, I have a timer function which gets called every 30 seconds. When it gets invoked, an ajax call will be sent to the server to save the diagram data. I am using diagram.isModified to check whether the ajax call is required and this flag will get reset when the successful response is attained.

My questions is if there is a built-in function that I can use to block user inputs while waiting for the response from the server.


Diagram.isEnabled = false.

Note that setting this permission only disables user’s input events – your code is never prohibited from making changes to the diagram or the model.

Of course because JavaScript in the browser is single-threaded, such disablement is unnecessary if your save protocol request can be executed synchronously, even if getting an acknowledgement (success or failure) is asynchronous.

Thanks for the reply. I found that flag too, but I am wondering if there is an UI indication like to gray out the whole diagram to let the user know that no update is allowed now. I guess I have to implement that myself, right?

Yes, you can. It’s on our list of nice-to-have features, some day.