0

I'm trying to persist MXGraph to DB and re generate upon user request. Below is how use user flow is:

  • Created HTML for Vertex
  • Added vertex (v) to Graph
  • select HTML element (v.getElementById())
  • modify HTML in (V) vertex
  • get XML of graph. Here is Code Snippt im usig to create XML

    var enc = new mxCodec(mxUtils.createXmlDocument());
    var node = enc.encode(_editor.graph.getModel());
    var xml = mxUtils.getPrettyXml(node);
    
  • persist it to DB

From above, i'm able to HTML of vertex in Step:1 but not after step:3. But, im sure that i'm trying above code snippet after modifying DOM in STEP:3.

Please let me know how to get XML (with dynamically made HTML Changes).

Prasad.CH
  • 492
  • 1
  • 5
  • 25

1 Answers1

1

The label is not updated in the model if the corresponding DOM element is changed directly. To change the label you can either use mxGraphModel.setValue to update and repaint it directly, or install event listeners in the label that update the state of the user object as demonstrated in the htmllabel.html example:

Frodo Baggins
  • 8,290
  • 6
  • 45
  • 55