mxGraph javascript Grapheditor 保存按钮变灰 - 我可以使用 PHP 保存图形 xml 文件和图像吗?
mxGraph javascript Grapheditor save button is greyed out - Can i use PHP to save graph xml file and image?
我从 https://github.com/jgraph/mxgraph 克隆了 mxGraph。
我已将浏览器指向 http://localhost/mxgraph/javascript/examples/grapheditor/www/
现在我可以创建图表了,但是我无法保存它们,因为 "Save" 和 "Save as..." 都是灰色。
- 如何启用保存?
- 我可以使用 PHP 来保存图像并使用 XML 来获得唯一的 ID 并保存在 MySQL 数据库 table 中吗?
如下启用保存选项。
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 本地存储中的 XML:
启用本地存储
Editor.useLocalStorage = true
然后,您可以从
获取XML文件
var temp = localStorage[filename.xml];
2.Get XML 动态:
请参考
的回答
我从 https://github.com/jgraph/mxgraph 克隆了 mxGraph。 我已将浏览器指向 http://localhost/mxgraph/javascript/examples/grapheditor/www/
现在我可以创建图表了,但是我无法保存它们,因为 "Save" 和 "Save as..." 都是灰色。
- 如何启用保存?
- 我可以使用 PHP 来保存图像并使用 XML 来获得唯一的 ID 并保存在 MySQL 数据库 table 中吗?
如下启用保存选项。
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 本地存储中的 XML:
启用本地存储
Editor.useLocalStorage = true
然后,您可以从
获取XML文件var temp = localStorage[filename.xml];
2.Get XML 动态:
请参考