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

℡╲_俬逩灬. 提交于 2019-12-10 12:35:46

问题


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();
    }
  }


来源:https://stackoverflow.com/questions/18397036/slickgrid-cell-text-selection-does-not-work-properly-in-chrome-or-firefox

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!