Hi!
I am downloaded and builded with grunt my modified index.html and index.js of app directory in master version of bpmn-io/bpmn-js-examples/properties-panel.
I am trying to create multiple new instances of BpmnModeler in an array when openDiagram function fires at “document ready” event and when e.g. clicking a button. The following code works on document ready stage but fails when clicking on the button on “second running”: uuid is a truly randomly generated id. Of course I fill the precondition to create appropriate dom elements (diagram, js-properties-panel) to be able to render elements.
var $ = require('jquery'),
BpmnModeler = require('bpmn-js/lib/Modeler');
var propertiesPanelModule = require('bpmn-js-properties-panel'),
propertiesProviderModule = require('bpmn-js-properties-panel/lib/provider/camunda'),
camundaModdleDescriptor = require('camunda-bpmn-moddle/resources/camunda');
function openDiagram(uuid, xml) {
modeler[uuid] = new BpmnModeler({
container: '#diagram-' + uuid,
propertiesPanel: {
parent: '#js-properties-panel-' + uuid
},
additionalModules: [
propertiesPanelModule,
propertiesProviderModule
],
moddleExtensions: {
camunda: camundaModdleDescriptor
}
});
modeler[uuid].importXML(xml, function(err) {
if (err) {
container
.removeClass('with-diagram')
.addClass('with-error');
container.find('.error pre').text(err.message);
console.error(err);
} else {
container
.removeClass('with-error')
.addClass('with-diagram');
}
// zoom to fit full viewport
modeler[uuid].get('canvas').zoom('fit-viewport');
});
}
I also tried this kind of code on the master version of bpmn-js (using simple bpmn-modeler.js without property-panel) and worked like a charm to create multiple instances.
Can somebody help me what can be the problem or show me an another concept how can I create multiple instances of BpmnModeler using property panel?
Thank you for your kind help in advance.