0

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.

Hardeep
  • 1
  • 1
  • Please add more context or even some sample code. Otherwise it will be hard to help you. – David Apr 02 '21 at 19:08

1 Answers1

0

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

sematik
  • 504
  • 3
  • 3