Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editors Fail With Slick.RowSelectionModel({selectActiveRow: true}) #68

Closed
cpeter0 opened this issue Dec 1, 2016 · 7 comments
Closed

Comments

@cpeter0
Copy link

cpeter0 commented Dec 1, 2016

Modify examples/example-checkbox-row-select.html line 89 to grid.setSelectionModel(new Slick.RowSelectionModel({selectActiveRow: true})); causes editing of cells to fail. Works in original SlickGrid.

@cpeter0
Copy link
Author

cpeter0 commented Dec 1, 2016

Apparently has something to do with line 90 grid.registerPlugin(checkboxSelector); If this is commented out the check boxes appear and are functional except for "select all rows" checkbox in grid header.

@cpeter0 cpeter0 closed this as completed Dec 1, 2016
@cpeter0 cpeter0 reopened this Dec 1, 2016
@Aibric
Copy link

Aibric commented Dec 9, 2016

I have the same problem ... ...

@6pac
Copy link
Owner

6pac commented Dec 9, 2016

will try to look at this soon

@6pac
Copy link
Owner

6pac commented Dec 27, 2016

This is a really complicated bug, unfortunately, to do with active cell selection.
It will probably take 6 to 10 hours to fix at some stage, and will involve reworking all the active cell logic for the grid.

I can't even work out a quick patch yet, but if I do I'll post it.

@ghiscoding
Copy link
Collaborator

ghiscoding commented May 11, 2018

I have a similar problem but not sure if it's the same issue. If I use Slick.CheckboxSelectColumn with any Inline Editor, when I click on a cell that is supposed to be editable the row selection kicks in and cancels out the editor.

Is there any known workaround for something similar?
I mainly want to use Inline Editor with Row Selection

EDIT
By troubleshooting it, I found out that the cancellation of the editor is caused by this line (shown below)

// this optimisation causes trouble - MLeibman #329
//if (activeCellChanged) {
if (!suppressActiveCellChangedEvent) { trigger(self.onActiveCellChanged, getActiveCell()); }
//}

EDIT 2
I got the desired effect by changing 1 line of code (shown below). The new effect is to not cancel editing and not do a row selection when the cell has an inline editor. So basically, if the cell has an editor, it does the editing and no row selection happens, however if the cell doesn't have any editor, it will do a row selection has usual which is what I would expect the grid to work.

So here's the 1 line of code that I changed (I added true as the 4th argument, which the argument is a flag named suppressActiveCellChangedEvent). Here is the SlickGrid line (shown below) and see below for the change

// this optimisation causes trouble - MLeibman #329
//if ((activeCell != cell.cell || activeRow != cell.row) && canCellBeActive(cell.row, cell.cell)) {
if (canCellBeActive(cell.row, cell.cell)) {
  if (!getEditorLock().isActive() || getEditorLock().commitCurrentEdit()) {
    scrollRowIntoView(cell.row, false);

    var preClickModeOn = (e.target && e.target.className === Slick.preClickClassName);
-    setActiveCellInternal(getCellNode(cell.row, cell.cell), null, preClickModeOn);
+    setActiveCellInternal(getCellNode(cell.row, cell.cell), null, preClickModeOn, true);
  }
}

Adding the last flag to true will cancel the if logic mentioned in my first edit which is this line

@6pac
Should I create a separate issue? .. or is it related to the current issue?
I can create a PR if this change is acceptable, I really need this to work in my Production App.

@ghiscoding
Copy link
Collaborator

Found the problem and made a PR in regards to the current issue. Made a fix to master by mistake, please disregard and look instead at the PR #241

6pac added a commit that referenced this issue May 12, 2018
fix issue #68 editor with activeRow selection
@ghiscoding
Copy link
Collaborator

I believe the original issue was covered in the PR that is now merged and so we should be safe to close the issue. If there's any problem, feel free to write something here or open a new issue. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants