2016-05-23 68 views
1

我正在使用mxgraph和图表页面,当我们选择一个单元格并给出一个值时,它应该只显示为超链接。但是当我使用html,锚定标记或其他方式时,整个代码以单元形式显示在单元格中。即使我试图动态输入值也显示为文本。将单元格值设置为mxGraph中的超链接

var Element123 = "<html><a href=''/Graph/Graph/' + globals.getProjID() + '/' + newValue +' '>' "+ selctedItem +" </a></html>" 
 
      this.graph.labelChanged(cell, Element123, evt); 
 
      this.graph.getModel().endUpdate(); 
 
     }

这里newValue为从下拉列表中选择的选项的标识。

回答

0

这里是我如何在mxGraph中为单元格值添加单击事件。 -

mxEvent.addListener(name, "click", function() { });

0

您需要在标签中启用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(); 
};