【发布时间】:2019-04-17 09:31:20
【问题描述】:
我有一个 d3 元素的矩形,我想点击那个矩形,应该会弹出一个带有复选框的弹出窗口。单击该复选框时,应调用一个函数。
截至目前,当我在 html 中调用一个函数时,该特定函数没有被调用
mini.append("g").selectAll("miniItems")
.data(data)
.enter().append("rect")
.attr("id", "rect")
.attr("x", 200)
.attr("y", function(d,i) {return y2(i*1.2)+5;})
.attr("width", windowWidth - 700)
.attr("height", 15)
.attr("stroke", "grey")
.on("click", onClick);/*on click of d3 element this function is invoked*/
function onClick(d){
let content;
content = "<div style='background: white;width:70px; box-shadow:3px 3px 5px #797878;height:30px; padding:8%'><input type='checkbox' id='myCheck' (click)='onClaim(d.executionId)'></input>"+ "claim" + "</div>";
div.html(content)
.style("left", (d3.event.pageX) + "px")
.style("top", (d3.event.pageY) + "px")
.style("display", "block");
}
function onClaim(value){/*this function is not executed*/
console.log(value);
}
我没有得到任何解决方案来调用该函数
任何帮助表示赞赏。提前谢谢你:)
【问题讨论】:
标签: javascript html angular d3.js