Advertisement
Pandaaaa906

Untitled

Sep 29th, 2021
1,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const handleMouseDown = (event, coords, td)=>{
  2.         let now = new Date().getTime();
  3.         // check if dbl-clicked within 1/5th of a second. change 200 (milliseconds) to other value if you want
  4.         if(!(td.lastClick && now - td.lastClick < 200)) {
  5.             td.lastClick = now;
  6.             return; // no double-click detected
  7.         }
  8.  
  9.         // double-click code goes here
  10.         const instance = hot.current?.hotInstance;
  11.         if(!instance){return}
  12.         const s = instance.getSelected()
  13.         if(s===undefined){
  14.             return false
  15.         }
  16.         const data = instance.getSourceDataAtRow(s[0][0])
  17.         if(data===null){
  18.             return false
  19.         }
  20.         setSelectedData(data)
  21.         setDetailOpen(true)
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement