Dhtmlx grid context menu is not opening on LongPress in ipad


#1

Hi all,
We are using DHTMLXgrid Context menu in grid, which is not opening on LongPress in iPad. And are using “onBeforeContextMenu” event to get the data which will only get triggered by DHTMLgrid internally onRightClick.

Do we have a way to trigger this event on LongPress in iPad and open the ContextMenu?

Can someone please help me with this?


#2

Please, try to simulate your own longPress with the following code:

var timer;

function onlongtouch(x,y){
	timer = null;
    myContextMenu.showContextMenu(x, y);
}
function touchstart(e) {
	var x = e.touches[0].clientX
	var y = e.touches[0].clientY
    if (!timer) {
        timer = setTimeout(function(){onlongtouch(x,y)}, 800);
    }
}

function touchend() {
    if (timer) {
        clearTimeout(timer);
        timer = null;
    }
}

document.addEventListener("DOMContentLoaded", function(event) { 
    window.addEventListener("touchstart", touchstart, false);
    window.addEventListener("touchend", touchend, false);
});

Here is a working example:
http://snippet.dhtmlx.com/5/f0a993511