【发布时间】:2018-11-17 00:14:12
【问题描述】:
我已经创建了一个图表,并正在通过拖放将单元格设置到它上面。但是,当发生拖放或单击时,我找不到单击的单元格的 html 以供使用。
例如,我试图在mxEvent.CLICK 中获取被拖动元素的 ID。
graph.addListener(mxEvent.CLICK, function(sender, evt){
var cell = evt.properties.cell;
// cell.id is the cell id, not an id of html that's inside of it.
if(cell) {
var outer = cell.value.outerHTML; // I can see the HTML here encoded
}
})
更新:
所以当我的可拖动项目被创建时,我将 html 添加到带有value.setAttribute('htmlLabel', label); 的单元格中。但是 htmlLabel 似乎不是 evt 对象中任何地方的键。
【问题讨论】:
标签: javascript mxgraph