Skip to content

Commit

Permalink
- fix bug in columnpicker: column select menu would list all columns …
Browse files Browse the repository at this point in the history
…twice.

- adjusted setActiveCellInternal() and gotoCell() interface: instead of multiple boolean parameters, now a single settings object is passed in: examples have been adjusted accordingly. This makes the latter public API (and the setActiveCellInternal() internal API as well) behave more in line with 'explaining variables' best practices: see also http://blog.ometer.com/2011/01/20/boolean-parameters-are-wrong/ & http://programmers.stackexchange.com/questions/161970/is-defining-a-variable-to-name-a-method-argument-a-good-practice & http://programmers.stackexchange.com/questions/147977/is-it-wrong-to-use-a-boolean-parameter-to-determine-behavior & http://martinfowler.com/bliki/FlagArgument.html

- reorganized the LESS theme file: `prefix &` appender usage is great ( https://github.com/SomMeri/less4j/wiki/Less-language-Nesting#appender & http://blog.slaks.net/2013-09-29/less-css-secrets-of-the-ampersand/ ) but we cannot use it ( thanks to there being no movement on less/less.js#1075 to allow producing any kind of 'reduced' parent selector ) - the `slick-row` and `slick-cell` rules have been adjusted to ensure a `selected` or `active` row and cell is now visible

- also note that in relation to the above item, several fixes have been applied as the new colspan/rowspan feature implies that your `active` row (`activePosY`) is not necessarily identical to the `activeRow` of your `activeCellNode`: hence both navigation code and CSS styling now do not expect the `active-row` to always be the `activeRow` row: you may observe this corrected behaviour in the examples/example-0042-row-span.html example when navigating the grid: rowspanning cells can be 'active' while the actual 'active row' (tracked by `activePosY`) is not the top row of the current rowspanning cell: go to row 7 in the example and navigate left and right to observe that these new fixes now ensure that you stay on row 7 instead of being 'pulled up' to the top row of each of the rowspanning cells that you will visit and 'activate' while navigating left & right on that row.

- some examples showed that the minimal header row width enlargement (on scrollbar width' orth) is too small when the grid columns do not fill the available space, e.g. examples/example-0008-compound-editors.html: now the old slickgrid behaviour has been restored with a twist: the HEADER_ROW_WIDTH_CORRECTION constant defines the amount of extra width allotted to the right for each header/footer row.

- fixed bug where invalidating a row did not update the row DOM node attributes (classes, styles, etc.) on render; this was the main culprit why, for instance, selected rows would forever remain marked as selected -- until they disappear from view and later on may be completely regenerated, that is. Now the same 'metadata ~ attributes' processing methodology used for updating cell DOM nodes is also used for row DOM nodes.

- fixed bug where userland changes to a cells rowspan and/or colspan did not reflect properly in the rerender process: now the cleanup and update-on-dirty render process identifies DOM nodes lingering in the cache while they are now being overlapped by another colspan/rowspan-ing node: these nodes are now deleted. See examples/example-0042-row-span.html.

- fixed bug where userland rowheight changes did not reflect properly in the subsequent render/update process. See example-0042-row-span.html.

- augmented the getCellNodeBox() API to include rowspan/colspan info; this is used, for example, to produce corrected redraw range specs.

- ditto for getCellFromElement() API.

- as mentioned above, revisited the navigation code (goto* APIs) and applied several fixes (jumping over rows when gotoDown(), etc.); also fixes a crash due to a misunderstanding about the purpose of each field in the span object returned by these goto*() APIs.

- fixed a few crashes due to APIs being invoked by userland code using out-of-range row/cell coordinates.

- new public API: invalidateCellSpan() accepts a span (row/cell/rowspan/colspan) to invalidate; use this to invalidate a range of cells, e.g. following a selection range edit action.
  • Loading branch information
GerHobbelt committed Nov 5, 2014
1 parent 560ed59 commit 9c2cb59
Show file tree
Hide file tree
Showing 8 changed files with 744 additions and 484 deletions.
7 changes: 4 additions & 3 deletions controls/slick.columnpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@
// of the current column sort.
var current = grid.getColumns().slice(0);
var ordered = new Array(columns.length);
for (var i = 0; i < ordered.length; i++) {
if (grid.getColumnIndex(columns[i].id) != null) {
for (var i = 0; i < columns.length; i++) {
var idx = grid.getColumnIndex(columns[i].id);
if (idx == null) {
// If the column doesn't return a value from getColumnIndex,
// it is hidden. Leave it in this position.
// it is not visible. Inject it in its original position.
ordered[i] = columns[i];
} else {
// Otherwise, grab the next visible column.
Expand Down
10 changes: 8 additions & 2 deletions examples/example-0009-editing-with-undo.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ <h2>View Source:</h2>
assert(typeof grid.slickGridVersion);
if (command && grid.getEditorLock().cancelCurrentEdit()) {
command.undo();
grid.gotoCell(command.row, command.cell, false);
grid.gotoCell(command.row, command.cell, {
forceEdit: false,
takeFocus: false
});
}
}

Expand All @@ -129,7 +132,10 @@ <h2>View Source:</h2>
assert(typeof grid.getEditorLock === 'function');
assert(typeof grid.slickGridVersion);
if (command && grid.getEditorLock().cancelCurrentEdit()) {
grid.gotoCell(command.row, command.cell, false);
grid.gotoCell(command.row, command.cell, {
forceEdit: false,
takeFocus: false
});
command.execute();
}
}
Expand Down
7 changes: 5 additions & 2 deletions examples/example-0042-row-span.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,16 @@ <h2>View Source:</h2>
} else {
cell.rowspan = 5;
cell.colspan = 1;
}
grid.invalidateRow(3);
}
// Invalidate the entire area that's impacted by this change:
grid.invalidateCell(3, 1);
grid.render();
});

$('#toggleHeight').click(function (e) {
metadata[6].height = metadata[6].height === rowHeights[0] ? rowHeights[1] : rowHeights[0];
// When you change a row height, this impacts that row AND all rows below it,
// but this particular situation is detected inside invalidateRow()...
grid.invalidateRow(6);
grid.render();
});
Expand Down
5 changes: 4 additions & 1 deletion examples/example-0060-image-editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@
//e.preventDefault();
//e.stopPropagation();
grid.recentEvent = e; // no way to detect e.target in editor, so save it
grid.gotoCell(args.row, args.cell, true);
grid.gotoCell(args.row, args.cell, {
forceEdit: true,
takeFocus: false
});
})
})
</script>
Expand Down
5 changes: 4 additions & 1 deletion plugins/slick.cellexternalcopymanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,10 @@
//$focus.attr('tabIndex', '-1');
//$focus.focus();
//$focus.removeAttr('tabIndex');
_grid.setActiveCell(activeCell.row, activeCell.cell, true);
_grid.setActiveCell(activeCell.row, activeCell.cell, {
forceEdit: false,
takeFocus: true
});
}
}, _externalCopyActionWrapupDelay);

Expand Down
72 changes: 36 additions & 36 deletions slick-default-theme.css

Large diffs are not rendered by default.

Loading

0 comments on commit 9c2cb59

Please sign in to comment.