I am trying to add tree button items from my database table to my drop down menu, but the onclick event doesnt call the function being passed. Here is the error I am getting upon clicking the button. Any help would be appreciated.
addFormatItemHandler()
{
var self = this;
this.m_tree.formatItem.addHandler
(
function(p_sender, p_event)
{
var item = p_event.dataItem;
p_event.element.innerHTML = "<button onclick='myFunction()'></button>";
}
);
}
myFunction(){
console.log("My function");
}
Expected result: My function
Actual result: myFunction is not defined at HTMLButtonElement.onclick