need help regarding Dhtmlx and wijmo grid context menu and touch events when used in Iphone - safari

80 Views Asked by At

developed a webapp using dhtmlx 5.0 and wijmo grid. the app works fine when used in chrome(android). the context menu is opened with touch-'press and hold' but the same thing doesn't work when used in safari browser of iphone. The context menu doesn't open with any touch event in iphone. Please help with the events or library whatever required to make it work.

1

There are 1 best solutions below

0
On

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