[英]Remove Buttons Dynamically from table row
我将按钮添加到元素,如下所示。
(this.sample as any).element.addEventListener("mouseover", function (e) {
if ((e.target as HTMLElement).classList.contains("e-rowcell")) {
let ele: Element = e.target as Element;
let row = parentsUntil(ele, "e-row");
this.row = row;
row.lastChild.appendChild(this.button);
row.lastChild.appendChild(this.button1);
}
}.bind(this));
请参阅下面的stackblitz链接示例链接
删除您在“ mouseover”事件上添加的最后一个元素,我在mouseover事件之后添加了内部加载方法。
this.gridInstance.element.addEventListener("mouseleave", function(e){
console.log(this.lastRow.lastChild.lastChild.remove());
}.bind(this))
我已经测试过了
默认情况下,您可以在HTML中使用按钮,并在CSS中显示/隐藏它们。
button {
display: none;
}
.row:hover button {
display: block;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.