2

当我们选择一个单元格并给出一个值时,我正在处理 mxgraph 和图形页面,它应该只显示为超链接。但是当我使用 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。

4

2 回答 2

1

您需要在标签中启用 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();
};
于 2017-11-24T12:07:50.460 回答
0

这是我为 mxGraph 中的单元格值添加点击事件的方法。-

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

于 2016-06-14T17:54:44.893 回答