问题
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:
git clone git@github.com:mleibman/SlickGrid.git
- go to
examples
folder - edit the
example1-simple.html
- Add
enableTextSelectionOnCells: true
in options - Open
example1-simple.html
in FF/Chrome - 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