Skip to content

Commit 9c2cb59

Browse files
committed
- fix bug in columnpicker: column select menu would list all columns 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.
1 parent 560ed59 commit 9c2cb59

8 files changed

+744
-484
lines changed

controls/slick.columnpicker.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,11 @@
9393
// of the current column sort.
9494
var current = grid.getColumns().slice(0);
9595
var ordered = new Array(columns.length);
96-
for (var i = 0; i < ordered.length; i++) {
97-
if (grid.getColumnIndex(columns[i].id) != null) {
96+
for (var i = 0; i < columns.length; i++) {
97+
var idx = grid.getColumnIndex(columns[i].id);
98+
if (idx == null) {
9899
// If the column doesn't return a value from getColumnIndex,
99-
// it is hidden. Leave it in this position.
100+
// it is not visible. Inject it in its original position.
100101
ordered[i] = columns[i];
101102
} else {
102103
// Otherwise, grab the next visible column.

examples/example-0009-editing-with-undo.html

+8-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ <h2>View Source:</h2>
113113
assert(typeof grid.slickGridVersion);
114114
if (command && grid.getEditorLock().cancelCurrentEdit()) {
115115
command.undo();
116-
grid.gotoCell(command.row, command.cell, false);
116+
grid.gotoCell(command.row, command.cell, {
117+
forceEdit: false,
118+
takeFocus: false
119+
});
117120
}
118121
}
119122

@@ -129,7 +132,10 @@ <h2>View Source:</h2>
129132
assert(typeof grid.getEditorLock === 'function');
130133
assert(typeof grid.slickGridVersion);
131134
if (command && grid.getEditorLock().cancelCurrentEdit()) {
132-
grid.gotoCell(command.row, command.cell, false);
135+
grid.gotoCell(command.row, command.cell, {
136+
forceEdit: false,
137+
takeFocus: false
138+
});
133139
command.execute();
134140
}
135141
}

examples/example-0042-row-span.html

+5-2
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,16 @@ <h2>View Source:</h2>
154154
} else {
155155
cell.rowspan = 5;
156156
cell.colspan = 1;
157-
}
158-
grid.invalidateRow(3);
157+
}
158+
// Invalidate the entire area that's impacted by this change:
159+
grid.invalidateCell(3, 1);
159160
grid.render();
160161
});
161162

162163
$('#toggleHeight').click(function (e) {
163164
metadata[6].height = metadata[6].height === rowHeights[0] ? rowHeights[1] : rowHeights[0];
165+
// When you change a row height, this impacts that row AND all rows below it,
166+
// but this particular situation is detected inside invalidateRow()...
164167
grid.invalidateRow(6);
165168
grid.render();
166169
});

examples/example-0060-image-editor.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@
101101
//e.preventDefault();
102102
//e.stopPropagation();
103103
grid.recentEvent = e; // no way to detect e.target in editor, so save it
104-
grid.gotoCell(args.row, args.cell, true);
104+
grid.gotoCell(args.row, args.cell, {
105+
forceEdit: true,
106+
takeFocus: false
107+
});
105108
})
106109
})
107110
</script>

plugins/slick.cellexternalcopymanager.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,10 @@
560560
//$focus.attr('tabIndex', '-1');
561561
//$focus.focus();
562562
//$focus.removeAttr('tabIndex');
563-
_grid.setActiveCell(activeCell.row, activeCell.cell, true);
563+
_grid.setActiveCell(activeCell.row, activeCell.cell, {
564+
forceEdit: false,
565+
takeFocus: true
566+
});
564567
}
565568
}, _externalCopyActionWrapupDelay);
566569

slick-default-theme.css

+36-36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)