mleibman / SlickGrid

A lightning fast JavaScript grid/spreadsheet
http://wiki.github.com/mleibman/SlickGrid
MIT License
6.81k stars 1.98k forks source link

Fast double click vs slow double click #994

Open dkniffin opened 10 years ago

dkniffin commented 10 years ago

I'm not sure if there's currently a way to do this or not.

What I'm looking to do is have a double click on a row trigger a function, and a single click on an already selected row to trigger an edit. So the difference here a quick double click would trigger the function, whereas a slow double click would trigger the edit.

Hopefully that makes sense. Any ideas?

styfle commented 10 years ago

Typically the double-click speed at the OS-level so this is user configurable. Your app can listen for 'dblclick' and 'click' events and do different things depending on which event was fired.

dkniffin commented 10 years ago

That makes sense. I guess I'll have to have onDblClick and onClick listeners. The dblClick would trigger the function, and the click would have logic that either just selected the row, or triggered an edit if it's already selected.

Is there an example of how to trigger an edit for a field?

GerHobbelt commented 10 years ago

Bit of a warning there: we ran into trouble when handling both at the same time as the 'click' event would happen while you're on your way to double-click. That's why we integrated https://github.com/GerHobbelt/jquery-fixclick with slickgrid to handle both unambiguously. This means you'ld have to delay a bit for click detection as it can be part of a doubleclick that's just happening so you have to wait to make sure it's not a doubleclick.

Fundamentals in https://github.com/GerHobbelt/SlickGrid/commit/dfa05df10bd5fc8a8fd4a1776a59e23efda484d1

Met vriendelijke groeten / Best regards,

Ger Hobbelt


web: http://www.hobbelt.com/ http://www.hebbut.net/ mail: ger@hobbelt.com

mobile: +31-6-11 120 978

On Fri, Aug 22, 2014 at 6:38 PM, oddityoverseer13 notifications@github.com wrote:

That makes sense. I guess I'll have to have onDblClick and onClick listeners. The dblClick would trigger the function, and the click would have logic that either just selected the row, or triggered an edit if it's already selected.

Is there an example of how to trigger an edit for a field?

— Reply to this email directly or view it on GitHub https://github.com/mleibman/SlickGrid/issues/994#issuecomment-53086716.