warpech/jquery-handsontable — pull request #1005 by dotnetesse (2013-08-27 18:20:03+00:00)
Title: Fill handle bug fix

The double-click event on the fill handle is buggy, even on the demo
page. The problem seems to be two-fold. First, it only works when the
column to the left or the column to the right of the highlighted cell is
populated with data. The problem is in the selectAdjacent function. It
correctly calculates the highlighted cell, but incorrectly calculates
the proceeding rows to fill. Instead of looking at the cells that
proceed in the highlighted cell's column, it looks at the cells that
proceed in the column to the left and the column to the right of the
highlighted cell's column. This can be seen in the following if
statement:

if (!!data[r][select[1] - 1] || !!data[r][select[3] + 1]) {
maxR = r;
}

In the if condition, it looks at the correct row, but the incorrect
column by substracting 1 and adding 1 to the column part of the array.
Again, it's looking at the columns to the left and right of the
highlighted cell's column. But even if that's corrected by removing the
subtraction/addition, the second part of the problem is that by using !!
to convert or cast the value of the cell, a null or empty value will
return false, as you know. But it seems that we should be specifically
looking for null or empty cells to calculate the rows to fill. So I
found that the solution to this problem was to validate that the
returned value of a given cell was null or empty:

if (data[r][select[1]] === null || data[r][select[3]] === "") {
maxR = r;
}

In addition, to account for spare rows, I added the following statement
before the block of code that fills the cells:

maxR = (typeof maxR === 'undefined') ? maxR : maxR -
priv.settings.minSpareRows;
if (maxR) {
...
}

Making this change to my local copy of jquery.handsontable.full.js
allowed the double-click event on the fill handle to behave as expected.
This also works when multiple cells are highlighted.