1

I've cloned mxGraph from https://github.com/jgraph/mxgraph. I've pointed my browser to http://localhost/mxgraph/javascript/examples/grapheditor/www/

Now I can create graphs, however I cannot save them as both "Save" and "Save as..." is grey color.

enter image description here

  1. How can I enable save?
  2. Can I use PHP to save the image and XML so I can get and unique ID that I can save in a MySQL database table?
Europa
  • 974
  • 12
  • 40
  • Possible duplicate of [mxGraph -Save functionality not working locally](https://stackoverflow.com/questions/56664578/mxgraph-save-functionality-not-working-locally) – Frodo Baggins Jul 12 '19 at 18:15

1 Answers1

2

Enable the save option as below.

mxUtils.post(OPEN_URL, '', mxUtils.bind(this, function(req)
                {
                    var enabled = req.getStatus() != 404;
                    this.actions.get('open').setEnabled(enabled || Graph.fileSupport);
                    this.actions.get('import').setEnabled(enabled || Graph.fileSupport);
                    this.actions.get('save').setEnabled(true)
                    this.actions.get('saveAs').setEnabled(true);
                    this.actions.get('export').setEnabled(enabled);
                }));

1.Save the XML in Local Storage:

Enable local storage

Editor.useLocalStorage = true

then, you can get the XML file from

var temp = localStorage[filename.xml]; 

2.Get the XML dynamically:

Please refer the answer from here

Bala
  • 618
  • 5
  • 21