How add bpmn in mvc core2.2


#1

HI Iam use new project mv ccore2.2 iam add Library but dont show bpmn in page
iam see this error :

Untitled

<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.js"></script>
<script src="~/bpmnjs/bpmn-viewer.development.js"></script>
<link rel="stylesheet" href="https://unpkg.com/bpmn-js@3.2.2/dist/assets/diagram-js.css" />
<link rel="stylesheet" href="https://unpkg.com/bpmn-js@3.2.2/dist/assets/bpmn-font/css/bpmn.css" />
<script src="~/bpmnjs/bpmn-modeler.development.js"></script>


<div id="canvas"></div>

<button id="save-button">print to console</button>

//////
var diagramURL = './rtl.bpmn';
  
 //var diagramUrl = 'https://cdn.rawgit.com/bpmn-io/bpmn-js-examples/dfceecba/starter/diagram.bpmn';

//   var diagramURL = './rtl.bpmn';modeler instance
var bpmnModeler = new BpmnJS({
    container: '#canvas',
    keyboard: {
        bindTo: window
    }
});


/* Save diagram contents and print them to the console.
*/
function exportDiagram() {

    bpmnModeler.saveXML({ format: true }, function(err, xml) {

        if (err) {
            return console.error('could not save BPMN 2.0 diagram', err);
        }

        alert('Diagram exported. Check the developer tools!');

        console.log('DIAGRAM', xml);
    });
}

/**
 * Open diagram in our modeler instance.
 *

 */
function openDiagram(bpmnXML) {

    // import diagram
    bpmnModeler.importXML(bpmnXML, function(err) {

        if (err) {
            return console.error('could not import BPMN 2.0 diagram', err);
        }

        // access modeler components
        var canvas = bpmnModeler.get('canvas');
        var overlays = bpmnModeler.get('overlays');


        // zoom to fit full viewport
        canvas.zoom('fit-viewport');

        // attach an overlay to a node
        overlays.add('SCAN_OK', 'note', {
            position: {
                bottom: 0,
                right: 0
            },
            html: '<div class="diagram-note">Mixed up the labels?</div>'
        });

        // add marker
        canvas.addMarker('SCAN_OK', 'needs-discussion');
    });
}


// load external diagram file via AJAX and open it
//  $.get(diagramUrl, openDiagram, 'text');

// wire save button
$('#save-button').click(exportDiagram);


fetch(diagramURL)
   .then(r => r.text())
   .then(diagramXML => openDiagram(diagramXML));



#2

I do not see any error, which one do you see?


#3

It reveals your bpmn file is missing (GET http://localhost:5855/rtl.bpmn - 404). Make sure the file is available.


#4

tahnks iam think dont know rtl.bpmn vs… change rtl.bpmn to rtl.xml
sloved problem


closed #5

This topic was automatically closed after 6 hours. New replies are no longer allowed.