When you use gmail the emails are in a table. As the user hovers over a row, the row changes color and a couple icon buttons appear on the right hand side. The buttons only appear when the mouse is hovering over the row, when the user moves out they disappear.
is it possible to add buttons on hover for the treegrid in a similar fashion>
[app.component.html]
ngOnInit(): void { this.data = sampleData;
let btn = document.createElement("input");
btn.type = "button";
btn.id = "btn";
btn.classList.add("e-btn");
btn.value = "button";
btn.style.marginLeft = "10px";
btn.onclick = function(e) {
console.log("Button clicked");
};
this.button = btn;
}
load(args) {
this.treegrid.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");
let previousButton = document.getElementById("btn");
if(!isNullOrUndefined(previousButton)) {
previousButton.remove();
}
row.lastChild.appendChild(this.button);
}
}.bind(this))
}
|
Thanks Jagadesh, what does the bind(this) part of the statement do?