我正在mxgraph上工作,在graph页面中,当我们选择一个单元格并给出一个值时,它应该只显示为超链接。但当我使用html、锚定标记或其他方式时,整个代码在单元格中显示为文本。即使我尝试动态输入值,它也会显示为文本。
var Element123 = "<html><a href=''/Graph/Graph/' + globals.getProjID() + '/' + newValue +' '>' "+ selctedItem +" </a></html>"
this.graph.labelChanged(cell, Element123, evt);
this.graph.getModel().endUpdate();
}
这里的newValue是下拉列表中所选选项的ID。
最佳答案
需要在标签中启用HTML。您可以通过调用graph.setHtmlLabels(true)
对所有单元格执行此操作。或者可以重写以下方法来确定每个单元格:
/**
* Function: isHtmlLabel
*
* Returns true if the label must be rendered as HTML markup. The default
* implementation returns <htmlLabels>.
*
* Parameters:
*
* cell - <mxCell> whose label should be displayed as HTML markup.
*/
mxGraph.prototype.isHtmlLabel = function(cell)
{
return this.isHtmlLabels();
};