constructor() {
this.initialFlag = true;
}
// Grid’s dataBound event handler
onDataBound() {
// This event will be triggered each time the grid data is modified, so flag variable is used so that this case is executed only on Grid initial render
if (this.initialFlag) {
// Click event is bound to the Grid element
this.gridInstance.element.addEventListener("click", this.onClick.bind(this));
this.initialFlag = false;
}
}
// Grid click event function
onClick(args) {
// Check if target is column header using its default class
if (args.target.closest(".e-headercell")) {
// Executes on column header click
var columnText = args.target.innerText;
alert(columnText + " is clicked");
}
} |
onBtnClick() {
this.gridInstance.element.removeEventListener("click", this.onClick);
} |