I’m trying to obtain the pointer position (X & Y) when using the onMouseOver event, however I’m getting and error which says that the event ‘e’ is undefined. Here’s an extract of the code:
grid.attachEvent(“onMouseOver”,function(id,ind){
var node_level = parseInt(grid.getLevel(id));
if((node_level != 4) || (ind != 0)) {
hideFloatingDetails();
}else{
var posx = 0;
var posy = 0;
if (!e) var e = window.event;
if (e.pageX || e.pageY) {
posx = e.pageX;
posy = e.pageY;
}
else if (e.clientX || e.clientY) {
posx = e.clientX + document.body.scrollLeft
+ document.documentElement.scrollLeft;
posy = e.clientY + document.body.scrollTop
+ document.documentElement.scrollTop;
}
detailDiv=document.getElementById(theDiv);
detailDiv.style.left=posx+10+“px”;
detailDiv.style.top=posy+10+“px”;
showFloatingDetails();
}
})
Actually native html event object is not defined inside custom onMouseOver event handler.
To obtain it you need customize next line in dhtmlxgrid.js
if (!this.grid.callEvent(“onMouseOver”, [
r.idd,
c._cellIndex
]))
replaced with
if (!this.grid.callEvent(“onMouseOver”, [
r.idd,
c._cellIndex,
e
]))
after that you can use in your custom code
grid.attachEvent(“onMouseOver”,function(id,ind,e){
…
That’s great. Thank you.