I have a diagram where the properties of the DataInspector change depending on the selected figure. Can a DataInspector have a button that opens a modal? Since it’s dynamic and depends on the selected figure, I’m not sure if that’s possible.
Yes, you could modify the Data Inspector to include a button for some types of fields. However, you might now be at the point where implementing a custom properties editor would be better for your app than the generic Inspector is.
How can I create a custom inspector? Do you have any examples?
Sometimes like this:
inspector = new Inspector('myDataInspectorDiv', myDiagram, {
properties: {
// Example: Add a button for a specific figure type
customButton: {
show: Inspector.showIfPresent,
readOnly: true, // prevent editing
html: function(propName, propValue, inspector) {
// Create a button element that triggers a modal
let button = document.createElement('button');
button.textContent = 'Open Modal';
button.onclick = function() {
// Trigger your modal logic here
showModal(); // Vue.js method to open the modal
};
return button;
}
}
}
});
or how it works a custom Datainspector ?
No, you’ll need to copy the file and modify the buildPropertyRow
method, probably along with some supporting changes in the rest of the code.
you all right, its better implementing a custom Html data inspector, I found HTML Interaction | GoJS Diagramming Library
and that’s the solution thanks