Handsontable: Cell on double click event

Created on 17 Feb 2017  路  2Comments  路  Source: handsontable/handsontable

Is there any possible way to execute a method when you double click on a cell?

Answered

Most helpful comment

afterOnCellMouseDown: function(event, coords, td) {
  var now = new Date().getTime();
   // check if dbl-clicked within 1/5th of a second. change 200 (milliseconds) to other value if you want
  if(!(td.lastClick && now - td.lastClick < 200)) {
    td.lastClick = now;
    return; // no double-click detected
  }

  // double-click code goes here
  console.log('double clicked');
}

All 2 comments

Hi @sebastiendecraene you could track afterOnCellMouseDown event. Write down the last clicked element and check the time between clicks.
We do not provide any Handsontable double click event.

afterOnCellMouseDown: function(event, coords, td) {
  var now = new Date().getTime();
   // check if dbl-clicked within 1/5th of a second. change 200 (milliseconds) to other value if you want
  if(!(td.lastClick && now - td.lastClick < 200)) {
    td.lastClick = now;
    return; // no double-click detected
  }

  // double-click code goes here
  console.log('double clicked');
}
Was this page helpful?
0 / 5 - 0 ratings