Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make sure rowNode exists before trying to loop on it #874

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
[![Cypress.io](https://img.shields.io/badge/tested%20with-Cypress-04C38E.svg)](https://www.cypress.io/)
[![NPM downloads](https://img.shields.io/npm/dm/slickgrid.svg)](https://npmjs.org/package/slickgrid)
[![npm](https://img.shields.io/npm/v/slickgrid.svg?logo=npm&logoColor=fff&label=npm)](https://npmjs.org/package/slickgrid)
Expand All @@ -8,28 +9,40 @@

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

This is the acknowledged most active non-customised fork of SlickGrid.
This is the acknowledged most active fork of SlickGrid.

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.
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.

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.
We extended the project from the original SlickGrid foundation while also including the following changes:
- added a few more Plugins: RowDetail, CellMenu, ContextMenu, GridMenu, CustomTooltip, GridState
- merged [X-SlickGrid](https://github.com/ddomingues/X-SlickGrid) code into the project which brought Frozen Columns/Rows (aka Pinning)
- 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/))
- removed jQuery requirement in [v4](https://github.com/6pac/SlickGrid/wiki/Major-version-4.0---Removal-of-jQuery-requirement)

### Examples
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.

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

_For a basic TypeScript example, take a look at the v5.0 Annoucement & Migration guide shown below._

### Contributions
See [Contributing Guide](https://github.com/6pac/SlickGrid/blob/master/CONTRIBUTING.md)

### E2E Tests with Cypress
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.
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.

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
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
```bash
npm install # install all npm packages
npm run serve # run a local http server on port 8080
npm run cypress # open Cypress tool
npm run dev # run a local development server on port 8080 in watch mode (or `npm run serve` without watch)
npm run cypress # open Cypress UI tool
```
Once the Cypress UI is open, you can then click on "Run all Specs" to execute all E2E browser tests.

## SlickGrid 3.x drops jQueryUI requirement

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.
## Migrations

## SlickGrid 4.x drops jQuery requirement
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)
| SlickGrid | Migration Guide | Description |
| --------- | --------------- | ----------- |
| 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 |
| 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 |
10 changes: 7 additions & 3 deletions slick.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3543,6 +3543,10 @@ if (typeof Slick === "undefined") {
});
}
}

if (!cacheEntry.rowNode) {
cacheEntry.rowNode = [];
}
postProcessedCleanupQueue.push({
actionType: 'R',
groupId: postProcessgroupId,
Expand All @@ -3566,7 +3570,7 @@ if (typeof Slick === "undefined") {

function removeRowFromCache(row) {
var cacheEntry = rowsCache[row];
if (!cacheEntry) {
if (!cacheEntry || !cacheEntry.rowNode) {
return;
}

Expand Down Expand Up @@ -5113,7 +5117,7 @@ if (typeof Slick === "undefined") {
if (activeCellNode !== null) {
makeActiveCellNormal();
activeCellNode.classList.remove("active");
if (rowsCache[activeRow]) {
if (rowsCache[activeRow] && rowsCache[activeRow].rowNode) {
rowsCache[activeRow].rowNode.forEach(function (node) {
node.classList.remove("active");
});
Expand Down Expand Up @@ -5146,7 +5150,7 @@ if (typeof Slick === "undefined") {

if (options.showCellSelection) {
activeCellNode.classList.add("active");
if (rowsCache[activeRow]) {
if (rowsCache[activeRow] && rowsCache[activeRow].rowNode) {
rowsCache[activeRow].rowNode.forEach(function (node) {
node.classList.add("active");
});
Expand Down