Skip to content

Commit d574a43

Browse files
authored
fix: make sure rowNode exists before trying to loop on it (#874)
* fix: make sure rowNode exists before trying to loop on it * docs: improve readme
1 parent f1cace4 commit d574a43

File tree

2 files changed

+32
-15
lines changed

2 files changed

+32
-15
lines changed

README.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2+
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
23
[![Cypress.io](https://img.shields.io/badge/tested%20with-Cypress-04C38E.svg)](https://www.cypress.io/)
34
[![NPM downloads](https://img.shields.io/npm/dm/slickgrid.svg)](https://npmjs.org/package/slickgrid)
45
[![npm](https://img.shields.io/npm/v/slickgrid.svg?logo=npm&logoColor=fff&label=npm)](https://npmjs.org/package/slickgrid)
@@ -8,28 +9,40 @@
89

910
Check out the NEW SlickGrid Website! http://slickgrid.net/
1011

11-
This is the acknowledged most active non-customised fork of SlickGrid.
12+
This is the acknowledged most active fork of SlickGrid.
1213

13-
It aims to be a viable alternative master repo, building on the legacy of the mleibman/SlickGrid master branch, keeping libraries up to date and applying small, safe core patches and enhancements without turning into a personalised build. Our biggest changes include the merge of X-SlickGrid that brought Frozen columns/rows, we then also removed jQuery & jQueryUI and are now using native browser code in SlickGrid.
14+
It aims to be a viable alternative master repo, building on the legacy of the [mleibman/SlickGrid](https://github.com/mleibman/SlickGrid) master branch, keeping libraries up to date and applying, safe core patches and enhancements to keep the project up to date.
1415

15-
Check out the **[Examples](https://github.com/6pac/SlickGrid/wiki/Examples)** for examples demonstrating new features and use cases, such as dynamic grid creation and editors with third party controls.
16+
We extended the project from the original SlickGrid foundation while also including the following changes:
17+
- added a few more Plugins: RowDetail, CellMenu, ContextMenu, GridMenu, CustomTooltip, GridState
18+
- merged [X-SlickGrid](https://github.com/ddomingues/X-SlickGrid) code into the project which brought Frozen Columns/Rows (aka Pinning)
19+
- removed jQueryUI requirement in [v3](https://github.com/6pac/SlickGrid/wiki/Major-version-3.0----Removal-of-jQueryUI-requirement-(replaced-by-SortableJS)) (replaced it with [SortableJS](https://sortablejs.github.io/Sortable/))
20+
- removed jQuery requirement in [v4](https://github.com/6pac/SlickGrid/wiki/Major-version-4.0---Removal-of-jQuery-requirement)
21+
22+
### Examples
23+
Check out the **[Examples](https://github.com/6pac/SlickGrid/wiki/Examples)** Wiki for a full list of examples demonstrating new features and use cases, such as dynamic grid creation and editors with third party controls.
1624

1725
Also check out the [Wiki](https://github.com/6pac/SlickGrid/wiki) for news and documentation.
1826

27+
_For a basic TypeScript example, take a look at the v5.0 Annoucement & Migration guide shown below._
28+
29+
### Contributions
30+
See [Contributing Guide](https://github.com/6pac/SlickGrid/blob/master/CONTRIBUTING.md)
31+
1932
### E2E Tests with Cypress
20-
We are now starting to add E2E (end to end) tests in the browser with [Cypress](https://www.cypress.io/). You can see [here](https://github.com/6pac/SlickGrid/tree/master/cypress/integration) the list of Examples that now have E2E tests. We also added these tests to the [GitHub Actions](https://github.com/features/actions) Workflow to automate certain steps while making sure any new commits aren't breaking the build/test. It will basically run all the E2E tests every time someone pushes a Commit or a Pull Request.
33+
We have started to add E2E (end to end) tests in the browser by using [Cypress](https://www.cypress.io/). You can see [here](https://github.com/6pac/SlickGrid/tree/next/cypress/e2e) the list of Examples that now have E2E tests. We also added these tests to the [GitHub Actions](https://github.com/features/actions) Workflow (CI) to automate certain steps while also making sure that any new commits aren't breaking the build/tests. The concept is that it automatically runs all the E2E tests every time someone pushes a Commit or a Pull Request. We currently have tests for over 20+ examples with almost 300 tests.
2134

22-
We also welcome any new contributions (tests or fixes) and if you wish to add Cypress E2E tests, all you need to do is to clone the repo and then run the following commands
35+
We welcome any new contributions (tests or fixes) and if you wish to add Cypress E2E tests, all you need to do is to clone the repo and run the following commands
2336
```bash
2437
npm install # install all npm packages
25-
npm run serve # run a local http server on port 8080
26-
npm run cypress # open Cypress tool
38+
npm run dev # run a local development server on port 8080 in watch mode (or `npm run serve` without watch)
39+
npm run cypress # open Cypress UI tool
2740
```
2841
Once the Cypress UI is open, you can then click on "Run all Specs" to execute all E2E browser tests.
2942

30-
## SlickGrid 3.x drops jQueryUI requirement
31-
32-
We no longer require [jQueryUI](https://jqueryui.com/) in SlickGrid 3.0, we removed all associated code and replaced it with [SortableJS](https://sortablejs.github.io/Sortable/) which is a lot more modern and touch friendly. Please read [SlickGrid 3.0 - Annoucement & Migration](https://github.com/6pac/SlickGrid/wiki/Major-version-3.0----Removal-of-jQueryUI-requirement-(replaced-by-SortableJS)) Wiki for more info.
43+
## Migrations
3344

34-
## SlickGrid 4.x drops jQuery requirement
35-
SlickGrid is now using browser native code and no longer requires jQuery in SlickGrid 4.0. For more info, please read [SlickGrid 4.0 - Annoucement & Migration](https://github.com/6pac/SlickGrid/wiki/Major-version-4.0---Removal-of-jQuery-requirement)
45+
| SlickGrid | Migration Guide | Description |
46+
| --------- | --------------- | ----------- |
47+
| 3.x | [Announcing v3.0](https://github.com/6pac/SlickGrid/wiki/Major-version-3.0----Removal-of-jQueryUI-requirement-(replaced-by-SortableJS)) | dropping [jQueryUI](https://jqueryui.com/) requirement and replaced it with [SortableJS](https://sortablejs.github.io/Sortable/) which is a lot more modern and touch friendly |
48+
| 4.x | [Announcing v4.0](https://github.com/6pac/SlickGrid/wiki/Major-version-4.0---Removal-of-jQuery-requirement) | dropping [jQuery](https://jquery.com/) requirement, SlickGrid is now using browser native code |

slick.grid.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3543,6 +3543,10 @@ if (typeof Slick === "undefined") {
35433543
});
35443544
}
35453545
}
3546+
3547+
if (!cacheEntry.rowNode) {
3548+
cacheEntry.rowNode = [];
3549+
}
35463550
postProcessedCleanupQueue.push({
35473551
actionType: 'R',
35483552
groupId: postProcessgroupId,
@@ -3566,7 +3570,7 @@ if (typeof Slick === "undefined") {
35663570

35673571
function removeRowFromCache(row) {
35683572
var cacheEntry = rowsCache[row];
3569-
if (!cacheEntry) {
3573+
if (!cacheEntry || !cacheEntry.rowNode) {
35703574
return;
35713575
}
35723576

@@ -5113,7 +5117,7 @@ if (typeof Slick === "undefined") {
51135117
if (activeCellNode !== null) {
51145118
makeActiveCellNormal();
51155119
activeCellNode.classList.remove("active");
5116-
if (rowsCache[activeRow]) {
5120+
if (rowsCache[activeRow] && rowsCache[activeRow].rowNode) {
51175121
rowsCache[activeRow].rowNode.forEach(function (node) {
51185122
node.classList.remove("active");
51195123
});
@@ -5146,7 +5150,7 @@ if (typeof Slick === "undefined") {
51465150

51475151
if (options.showCellSelection) {
51485152
activeCellNode.classList.add("active");
5149-
if (rowsCache[activeRow]) {
5153+
if (rowsCache[activeRow] && rowsCache[activeRow].rowNode) {
51505154
rowsCache[activeRow].rowNode.forEach(function (node) {
51515155
node.classList.add("active");
51525156
});

0 commit comments

Comments
 (0)