Slickgrid cell text selection does not work proper

2019-06-15 14:10发布

问题:

I have set enableTextSelectionOnCells according to SlickGrid and Text Selection.

I am not really happy about it.

Cell text gets selected with a bad behaviour. Sometimes as soon as selection is done, the selection disappears. Only on rare occasions does it work.

Has anyone faced this issue?

I have tried this on Firefox and Chrome.

to reproduce:

  1. git clone git@github.com:mleibman/SlickGrid.git
  2. go to examples folder
  3. edit the example1-simple.html
  4. Add enableTextSelectionOnCells: true in options
  5. Open example1-simple.html in FF/Chrome
  6. Try selecting a cell value

FYI, I am running on Ubuntu if it should make any difference.

回答1:

This problem is already solved on Github. You just have to modify slick.gird.js. Around line number 2270, you just have to add " options.editable && ". Hope this help.

if (!currentEditor) {
    // if this click resulted in some cell child node getting focus,
    // don't steal it back - keyboard events will still bubble up
    // IE9+ seems to default DIVs to tabIndex=0 instead of -1, so check for cell clicks directly.
    if (options.editable && e.target != document.activeElement || $(e.target).hasClass("slick-cell")) {
      setFocus();
    }
  }


标签: slickgrid