Search code examples
javascriptjqueryslickgrid

slickgrid text selection not working in cells


I've researched this question a bit. 3-4 months ago, the fix to use "enableTextSelectionOnCells" worked, but has broken again. I'm using v2.1 and implemented the following solutions:

Text selection in slickgrid

Slickgrid cell text selection does not work properly in Chrome or Firefox

however, the issue persists.

What happens is, when the code gets to if (selection.rangeCount > 0) {, the selection.rangeCount is 0. When I click and drag the mouse, no highlighting occurs as if I'm actually selecting text.

Is there something else at play here? Any suggestions to debug further?

I'm using latest chrome and firefox.


Solution

  • Turns out another jquery addon was interfering.

    jquery.flot.navigate includes jquery.event.drag.js ~ v1.5, which traps the mousedown event when you try to click to select text.

    My fix to minimize impact on the code base was to write a more specific delegate to trap the event first, and call e.stopPropagation();