Posted 18 October 2019, 2:13 am EST
Is Context Menu feature available for DVJs?
Forums Home / Spread / DataViewsJS
Posted by: nchalla on 18 October 2019, 2:13 am EST
Posted 18 October 2019, 2:13 am EST
Is Context Menu feature available for DVJs?
Posted 21 October 2019, 4:47 am EST
Hi,
There is no inbuilt support for context menu but we could easily create a context menu for the DVJS by handling the contextmenu event on its container. Please refer to the following code snippet and the sample demonstrating the same:
dv.container.addEventListener("contextmenu", e => {
let htinfo = dv.hitTest(e);
if (!htinfo || htinfo.area !== "viewport") {
return;
}
showContextMenu(e, dv, htinfo);
e.preventDefault();
});
https://codesandbox.io/s/dvjs-sample-4x7n9
Regards
Sharad