I hope the same diagram work in several mode, say, edit mode vs. readonly mode.
In edit mode, controls in the editbar are writable, while in readonly mode, controls are disabled.
These configures could be set in the editor=new dhx.DiagramEditor(…,{view:…}) stage.
How can the view property be changed on runtime. Like:
Just as clarification, as I understand, you want to dynamically make editbar of diagram_editor read-only or editable, am I right?
The most expected approach for similar cases is to use diagram + diagramEditor so you will be able to switch between readonly(diagram) and editable(diagram editor) modes: https://snippet.dhtmlx.com/9ahg7ct4
Currently, it’s possible to make controls of editbar dynamic(based on user conditions), as described by the following link:
If your requirement is to make editbar readonly on the fly (based on some control click), you may use such workaround, by manual disabling editbar on each shape select(you also can extend it with condition):
editor.diagram.events.on("afterSelect", ({ id }) => {
// may be used with some condition if(true)...
editor.view._editbar._form.disable();
});
Thanks for your quick reply.
Not exactly the writable and readonly.
Actually in my scenario I hope the editorbar vary depending upon different selected item instead of selected shape.
For example, one rectangle could have stroke and font properties, while another rectangle requires an extra radiogroup, no stroke and disabled font.
Thanks for your quick reply.
Not exactly the writable and readonly.
Actually in my scenario I hope the editorbar vary depending upon different selected item instead of selected shape.
For example, one rectangle could have stroke and font properties, while another rectangle requires an extra radiogroup, no stroke and disabled font.
Thank you for the clarification. It seems that the best approach for your case, will be to conditional set up controls from properties, as described by the following link:
So you can define different controls(or same controls with different configs) based on your conditions, like in the demo below: https://snippet.dhtmlx.com/fz1tul8r
(only Chairman & CEO shape will have editable input)