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

Changes made to handleClick() in slick.grid.js break row selection #76

Open
jusbuc2k opened this issue May 21, 2014 · 2 comments
Open

Comments

@jusbuc2k
Copy link

The last block of handleClick() breaks row selection, because it only calls setActiveCellInternal if there are frozen rows.

I fixed this by changing this:

handleClick() {
...
  if ((activeCell != cell.cell || activeRow != cell.row) && canCellBeActive(cell.row, cell.cell)) {
                if (!getEditorLock().isActive() || getEditorLock().commitCurrentEdit()) {
                    if (hasFrozenRows) {
                        if (( !( options.frozenBottom ) && ( cell.row >= actualFrozenRow ) )
                            || ( options.frozenBottom && ( cell.row < actualFrozenRow ) )
                            ) {
                            scrollRowIntoView(cell.row, false);
                        }

                        setActiveCellInternal(getCellNode(cell.row, cell.cell));
                    }
                }
            }
}

to this:

handleClick() {
...
  if ((activeCell != cell.cell || activeRow != cell.row) && canCellBeActive(cell.row, cell.cell)) {
                if (!getEditorLock().isActive() || getEditorLock().commitCurrentEdit()) {
                    if (hasFrozenRows) {
                        if (( !( options.frozenBottom ) && ( cell.row >= actualFrozenRow ) )
                            || ( options.frozenBottom && ( cell.row < actualFrozenRow ) )
                            ) {
                            // what was the point here?
                        }
                    }
                    scrollRowIntoView(cell.row, false);
                    setActiveCellInternal(getCellNode(cell.row, cell.cell));
                }
            }
}

This eliminates any difference of handling on hasFrozenRows or not, However, I have to believe there was a reason for the conditional, but I'm not sure what it was.

Edit: Fixed codeblocks md syntax.

@jusbuc2k jusbuc2k changed the title Changes made to handleClick() in slick.grid.js break row selection is broken Changes made to handleClick() in slick.grid.js break row selection May 21, 2014
@gigermocas
Copy link

I had to make a similar fix on my side, as this was breaking my app regarding editor activation on click.

@Rybadour
Copy link

Rybadour commented Aug 7, 2014

@jusbuc2k
Assuming you want to keep his intentions you should change it to the following instead:

handleClick() {
...
  if ((activeCell != cell.cell || activeRow != cell.row) && canCellBeActive(cell.row, cell.cell)) {
                if (!getEditorLock().isActive() || getEditorLock().commitCurrentEdit()) {
                    if (hasFrozenRows) {
                        if (( !( options.frozenBottom ) && ( cell.row >= actualFrozenRow ) )
                            || ( options.frozenBottom && ( cell.row < actualFrozenRow ) )
                            ) {
                            scrollRowIntoView(cell.row, false);
                        }
                    } else {
                        scrollRowIntoView(cell.row, false);
                    }

                    setActiveCellInternal(getCellNode(cell.row, cell.cell));
                }
            }
}

chabb pushed a commit to ts-blink/SlickGrid that referenced this issue May 10, 2016
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

3 participants