JLynch7 / SlickGrid

A lightning fast JavaScript grid/spreadsheet
https://github.com/jlynch7/SlickGrid/wiki
MIT License
89 stars 76 forks source link

setActiveCellInternal and scrollRowIntoView are not called when they should be #63

Open HobbsB opened 10 years ago

HobbsB commented 10 years ago

Please forgive me if I am just missing something.

in slick.grid.js: function handleClick(e)

the functions: scrollRowIntoView(cell.row, false); setActiveCellInternal(getCellNode(cell.row, cell.cell));

are not called unless there are frozen rows. This does not appear correct to me, because auto-edit will then require a double click to edit cells. Should there be an else condition for this, to operate as it does in the original?

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

modified to something like:

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));
                }
               else {
                   scrollRowIntoView(cell.row, false);
                    setActiveCellInternal(getCellNode(cell.row, cell.cell));
              }
            }
        }