Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
GitHub - bpmn-io/bpmn-js: A BPMN 2.0 renderer and web modeler[^]


I m working based on this , I know that it is possible to save diagram as XML. But how to do it. I tried to use the SaveXML as below by wrapping the SaveXML inside a javascript function. Added a button and called the javascript function. But nothing happens. Its showing error done is not defined. I am not sure how to handle this.

The view is rendering the model using the below code, ie from the xml file. So I expect to update the same xml and also prove New, Open options.

JavaScript
$.get('../resources/pizza-collaboration.xml', function(pizzaDiagram) {

  bpmnjs.importXML(pizzaDiagram, function(err) {

    if (err) {
      return fail(err);
    }

    try {
      bpmnjs.get('canvas').zoom('fit-viewport');
      return success();
    } catch (e) {
      return fail(e);
    }
  });

}, 'text');


What I have tried:

function saveDiagram() {
bpmnjs.saveXML({ format: true }, function (err, xml) {
done(err, xml);
});
}
Posted
Updated 15-Feb-16 20:39pm
v3
Comments
Kornfeld Eliyahu Peter 15-Feb-16 7:58am    
And? What's wrong?
Member 10070308 16-Feb-16 2:39am    
Please see my updates in question

1 solution

JavaScript
function saveDiagram(done) {

    bpmnjs.saveXML({ format: true }, function (err, xml) {
        done(err, xml);
    });
}



JavaScript
function Save() {
    saveDiagram(function (err, xml) {
        $.ajax({
            type: "POST",
            url: '/Home/SaveBPMModel',
            data: {
                strXml: xml,

            },
        success: function (data) {
            SuccesMessage("Saved Successfully");

        }
    });
    });
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900