From 00a0daa2680888a040ac44440c2edcd453285c77 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Mon, 22 Apr 2024 15:05:27 -0400 Subject: [PATCH 01/20] bump to v31.2.1 (cherry picked from commit 4325cabeb602cb82f9469fbb769f41b78f313e4e) --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 12a337a..1916e7c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dash-ag-grid", - "version": "31.0.1", + "version": "31.2.1", "description": "Dash wrapper around AG Grid, the best interactive data grid for the web.", "repository": { "type": "git", @@ -31,9 +31,9 @@ "dependencies": { "@emotion/react": "^11.11.3", "@emotion/styled": "^11.11.0", - "ag-grid-community": "31.1.1", - "ag-grid-enterprise": "31.1.1", - "ag-grid-react": "31.1.1", + "ag-grid-community": "31.2.1", + "ag-grid-enterprise": "31.2.1", + "ag-grid-react": "31.2.1", "@mui/icons-material": "^5.15.7", "@mui/material": "^5.15.7", "d3-format": "^3.1.0", From e95905be1b922c65cae74ccdbbdc8b0bcdb08071 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Mon, 22 Apr 2024 15:24:54 -0400 Subject: [PATCH 02/20] fixing deprecation (cherry picked from commit eace7ca59a195570cb82f8f4f9d1b3ac5ea4b0ee) --- src/lib/fragments/AgGrid.react.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/fragments/AgGrid.react.js b/src/lib/fragments/AgGrid.react.js index f85d644..2cbde70 100644 --- a/src/lib/fragments/AgGrid.react.js +++ b/src/lib/fragments/AgGrid.react.js @@ -924,7 +924,7 @@ export default class DashAgGrid extends Component { const {rowModelType, eventListeners} = this.props; if (rowModelType === 'infinite') { - params.api.setDatasource(this.getDatasource()); + params.api.setGridOption('datasource', this.getDatasource()); } if (eventListeners) { From d6d8f18efd9eb3b43390e3dae851b04715d11e82 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Mon, 22 Apr 2024 15:41:07 -0400 Subject: [PATCH 03/20] updating changelog (cherry picked from commit 722ecf86e6e0605e23514ea5b2d9d254c2432c5e) --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2accb22..0605a90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ Links "DE#nnn" prior to version 2.0 point to the Dash Enterprise closed-source D ### Changed - [#273](https://github.com/plotly/dash-ag-grid/pull/273) increased the timeout for `getApiAsync` to 2 minutes. + - [#281](https://github.com/plotly/dash-ag-grid/pull/281) webpack is now designed to build quicker, excludes `node_modules` and uses a different parser + - [#287](https://github.com/plotly/dash-ag-grid/pull/287) bumping to v`31.2.1` for the grid ### Added - [#270](https://github.com/plotly/dash-ag-grid/pull/270) @@ -15,6 +17,15 @@ Links "DE#nnn" prior to version 2.0 point to the Dash Enterprise closed-source D - `eventListeners` are added upon `gridReady` only, if you need to add or remove other event listeners, please use the `getApi` or `getApiAsync` methods - added default for `selectedRows` to be `[]` +### Fixed + - [#283](https://github.com/plotly/dash-ag-grid/pull/283) + - `selectedRows` can now be passed along with the `rowData` + - fixes [#274](https://github.com/plotly/dash-ag-grid/issues/274) + - fixes [#282](https://github.com/plotly/dash-ag-grid/issues/282) + - [#287](https://github.com/plotly/dash-ag-grid/pull/287) + - `aggFuncs` can now be passes as an object from the grid to be mapped to functions + - fixes [#278](https://github.com/plotly/dash-ag-grid/issues/278) + ## [31.0.1] - 2024-02-07 From 5f9a4ef5527dc0b8dfc73aa6344f6bc12fe53dd4 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Tue, 23 Apr 2024 14:24:14 -0400 Subject: [PATCH 04/20] bumping package-lock (cherry picked from commit 59484e417ff5864f2b1967283acf0110bc427d69) --- package-lock.json | 66 ++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/package-lock.json b/package-lock.json index ab56cd1..72741ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,21 @@ { "name": "dash-ag-grid", - "version": "31.0.1", + "version": "31.2.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "dash-ag-grid", - "version": "31.0.1", + "version": "31.2.1", "license": "MIT", "dependencies": { "@emotion/react": "^11.11.3", "@emotion/styled": "^11.11.0", "@mui/icons-material": "^5.15.7", "@mui/material": "^5.15.7", - "ag-grid-community": "31.1.1", - "ag-grid-enterprise": "31.1.1", - "ag-grid-react": "31.1.1", + "ag-grid-community": "31.2.1", + "ag-grid-enterprise": "31.2.1", + "ag-grid-react": "31.2.1", "d3-format": "^3.1.0", "d3-time": "^3.1.0", "d3-time-format": "^4.1.0", @@ -3413,25 +3413,31 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/ag-charts-community": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/ag-charts-community/-/ag-charts-community-9.2.0.tgz", + "integrity": "sha512-dS5nPExh81owIIdyHli0TvWvSyhmZy2RncM/s3/KXpjAf3eiVN2fxfT2z+QxqsLyoms+fernp5cAuSju0peYXw==" + }, "node_modules/ag-grid-community": { - "version": "31.1.1", - "resolved": "https://registry.npmjs.org/ag-grid-community/-/ag-grid-community-31.1.1.tgz", - "integrity": "sha512-tiQZ7VQ07yJScTMIQpaYoUMPgiyXMwYDcwTxe4riRrcYGTg0e258XEihoPUZFejR60P1fYWMxdJaR2JUnyhGrg==" + "version": "31.2.1", + "resolved": "https://registry.npmjs.org/ag-grid-community/-/ag-grid-community-31.2.1.tgz", + "integrity": "sha512-D+gnUQ4dHZ/EQJmupQnDqcEKiCEeuK5ZxlsIpdPKgHg/23dmW+aEdivtB9nLpSc2IEK0RUpchcSxeUT37Boo5A==" }, "node_modules/ag-grid-enterprise": { - "version": "31.1.1", - "resolved": "https://registry.npmjs.org/ag-grid-enterprise/-/ag-grid-enterprise-31.1.1.tgz", - "integrity": "sha512-hAy8x+P2KzpRb8RONvCj/FqLL0AJ4FEIEJsEuOEiZAEgi64TAhZv/FzIhIbAElPXf+OhCMKHIAKTD765vzCMOQ==", + "version": "31.2.1", + "resolved": "https://registry.npmjs.org/ag-grid-enterprise/-/ag-grid-enterprise-31.2.1.tgz", + "integrity": "sha512-gQLy+fHNwNC4AK0dF38TqCWdfQ2vaw4xoIpEMj1rEcp8xYpU3acX71np/DXNEIzM6gqB13qxT2L1p0zaah5pMw==", "dependencies": { - "ag-grid-community": "31.1.1" + "ag-charts-community": "9.2.0", + "ag-grid-community": "31.2.1" } }, "node_modules/ag-grid-react": { - "version": "31.1.1", - "resolved": "https://registry.npmjs.org/ag-grid-react/-/ag-grid-react-31.1.1.tgz", - "integrity": "sha512-aaDMSP8MGhoXL5M9c4UmhBClRlc3mEMMC0E0/1mhXU6bdiz0QxXT/xQtDe3DFC62VrtXVda9x20Lpj6p6Bfy8g==", + "version": "31.2.1", + "resolved": "https://registry.npmjs.org/ag-grid-react/-/ag-grid-react-31.2.1.tgz", + "integrity": "sha512-9UH3xxXRwZfW97oz58KboyCJl4t+zdetopieeHVcttsXX1DvGFDUIEz7A1sQaG8e1DAXLMf3IxoIPrfWheH4XA==", "dependencies": { - "ag-grid-community": "31.1.1", + "ag-grid-community": "31.2.1", "prop-types": "^15.8.1" }, "peerDependencies": { @@ -14691,25 +14697,31 @@ "dev": true, "requires": {} }, + "ag-charts-community": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/ag-charts-community/-/ag-charts-community-9.2.0.tgz", + "integrity": "sha512-dS5nPExh81owIIdyHli0TvWvSyhmZy2RncM/s3/KXpjAf3eiVN2fxfT2z+QxqsLyoms+fernp5cAuSju0peYXw==" + }, "ag-grid-community": { - "version": "31.1.1", - "resolved": "https://registry.npmjs.org/ag-grid-community/-/ag-grid-community-31.1.1.tgz", - "integrity": "sha512-tiQZ7VQ07yJScTMIQpaYoUMPgiyXMwYDcwTxe4riRrcYGTg0e258XEihoPUZFejR60P1fYWMxdJaR2JUnyhGrg==" + "version": "31.2.1", + "resolved": "https://registry.npmjs.org/ag-grid-community/-/ag-grid-community-31.2.1.tgz", + "integrity": "sha512-D+gnUQ4dHZ/EQJmupQnDqcEKiCEeuK5ZxlsIpdPKgHg/23dmW+aEdivtB9nLpSc2IEK0RUpchcSxeUT37Boo5A==" }, "ag-grid-enterprise": { - "version": "31.1.1", - "resolved": "https://registry.npmjs.org/ag-grid-enterprise/-/ag-grid-enterprise-31.1.1.tgz", - "integrity": "sha512-hAy8x+P2KzpRb8RONvCj/FqLL0AJ4FEIEJsEuOEiZAEgi64TAhZv/FzIhIbAElPXf+OhCMKHIAKTD765vzCMOQ==", + "version": "31.2.1", + "resolved": "https://registry.npmjs.org/ag-grid-enterprise/-/ag-grid-enterprise-31.2.1.tgz", + "integrity": "sha512-gQLy+fHNwNC4AK0dF38TqCWdfQ2vaw4xoIpEMj1rEcp8xYpU3acX71np/DXNEIzM6gqB13qxT2L1p0zaah5pMw==", "requires": { - "ag-grid-community": "31.1.1" + "ag-charts-community": "9.2.0", + "ag-grid-community": "31.2.1" } }, "ag-grid-react": { - "version": "31.1.1", - "resolved": "https://registry.npmjs.org/ag-grid-react/-/ag-grid-react-31.1.1.tgz", - "integrity": "sha512-aaDMSP8MGhoXL5M9c4UmhBClRlc3mEMMC0E0/1mhXU6bdiz0QxXT/xQtDe3DFC62VrtXVda9x20Lpj6p6Bfy8g==", + "version": "31.2.1", + "resolved": "https://registry.npmjs.org/ag-grid-react/-/ag-grid-react-31.2.1.tgz", + "integrity": "sha512-9UH3xxXRwZfW97oz58KboyCJl4t+zdetopieeHVcttsXX1DvGFDUIEz7A1sQaG8e1DAXLMf3IxoIPrfWheH4XA==", "requires": { - "ag-grid-community": "31.1.1", + "ag-grid-community": "31.2.1", "prop-types": "^15.8.1" } }, From 77d3c43480efbc6de44e34fa4b31cff91f1ed1ba Mon Sep 17 00:00:00 2001 From: BSd3v Date: Wed, 24 Apr 2024 14:06:16 -0400 Subject: [PATCH 05/20] bumping AG Grid to v31.2 --- package.json | 2 +- tests/test_selected_rows.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1916e7c..6e70bcf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dash-ag-grid", - "version": "31.2.1", + "version": "31.0.1", "description": "Dash wrapper around AG Grid, the best interactive data grid for the web.", "repository": { "type": "git", diff --git a/tests/test_selected_rows.py b/tests/test_selected_rows.py index b156bd9..53fdafd 100644 --- a/tests/test_selected_rows.py +++ b/tests/test_selected_rows.py @@ -110,6 +110,7 @@ def test_sr2_selected_rows_rowdata(dash_duo): dag.AgGrid( id='grid', columnSize="sizeToFit", + columnDefs=[{'field': 'A'}], dashGridOptions={ "rowHeight": None, "domLayout": "normal", @@ -152,6 +153,8 @@ def update_selected_row_info(selected_rows): grid = utils.Grid(dash_duo, "grid") + grid.wait_for_header_text(0, 'A') + dash_duo.find_element('#update-button').click() grid.wait_for_cell_text(0, 0, "1") @@ -186,6 +189,7 @@ def test_sr3_selected_rows_modes(dash_duo): dag.AgGrid( id='grid', columnSize="sizeToFit", + columnDefs=[{'field': 'A'}], dashGridOptions={ "rowHeight": None, "domLayout": "normal", @@ -245,6 +249,8 @@ def update_selected_row_info(selected_rows): grid = utils.Grid(dash_duo, "grid") + grid.wait_for_header_text(0, 'A') + dash_duo.find_element('#update-button').click() grid.wait_for_cell_text(0, 0, "1") From 6de01cc7000fe2258ece38e0034465af83d9d841 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Wed, 24 Apr 2024 14:06:16 -0400 Subject: [PATCH 06/20] adjusting failing test for `selectedRows`, adding pause to wait for the grid to render a column header --- package.json | 2 +- tests/test_selected_rows.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1916e7c..6e70bcf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dash-ag-grid", - "version": "31.2.1", + "version": "31.0.1", "description": "Dash wrapper around AG Grid, the best interactive data grid for the web.", "repository": { "type": "git", diff --git a/tests/test_selected_rows.py b/tests/test_selected_rows.py index b156bd9..53fdafd 100644 --- a/tests/test_selected_rows.py +++ b/tests/test_selected_rows.py @@ -110,6 +110,7 @@ def test_sr2_selected_rows_rowdata(dash_duo): dag.AgGrid( id='grid', columnSize="sizeToFit", + columnDefs=[{'field': 'A'}], dashGridOptions={ "rowHeight": None, "domLayout": "normal", @@ -152,6 +153,8 @@ def update_selected_row_info(selected_rows): grid = utils.Grid(dash_duo, "grid") + grid.wait_for_header_text(0, 'A') + dash_duo.find_element('#update-button').click() grid.wait_for_cell_text(0, 0, "1") @@ -186,6 +189,7 @@ def test_sr3_selected_rows_modes(dash_duo): dag.AgGrid( id='grid', columnSize="sizeToFit", + columnDefs=[{'field': 'A'}], dashGridOptions={ "rowHeight": None, "domLayout": "normal", @@ -245,6 +249,8 @@ def update_selected_row_info(selected_rows): grid = utils.Grid(dash_duo, "grid") + grid.wait_for_header_text(0, 'A') + dash_duo.find_element('#update-button').click() grid.wait_for_cell_text(0, 0, "1") From 3e1df4980ecc38a4ba598677cdf5b5bf8fe88076 Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 30 Apr 2024 11:42:20 -0400 Subject: [PATCH 07/20] Bump version number --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0605a90..91554a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to `dash-ag-grid` will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/). Links "DE#nnn" prior to version 2.0 point to the Dash Enterprise closed-source Dash AG Grid repo -## unreleased +## [31.2.0] - 2024-02-25 ### Changed - [#273](https://github.com/plotly/dash-ag-grid/pull/273) increased the timeout for `getApiAsync` to 2 minutes. diff --git a/package.json b/package.json index 6e70bcf..b304812 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dash-ag-grid", - "version": "31.0.1", + "version": "31.2.0", "description": "Dash wrapper around AG Grid, the best interactive data grid for the web.", "repository": { "type": "git", From f1bbc34cf2cccea6e1d6c57a21f005db7d898f6e Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 30 Apr 2024 15:12:45 -0400 Subject: [PATCH 08/20] Install requirements before generating dist --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f1a021e..0ec1167 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,7 @@ jobs: - name: Generate distribution run: | source .venv/bin/activate + uv pip install -r requires-dev.txt -r requires-install.txt npm i npm run dist npm pack && mv *.tgz dist/ From 48add9a4a3a0c4cc409d495461ef87a59b9d9822 Mon Sep 17 00:00:00 2001 From: Greg Wilson Date: Fri, 7 Jun 2024 13:18:06 -0400 Subject: [PATCH 09/20] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index f710433..f742ca4 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ Dash AG Grid is a Dash component wrapper for the AG Grid JavaScript package, ena The underlying AG Grid JavaScript package is a third-party software component developed by [AG Grid Ltd](http://www.ag-grid.com/). Many features are available for free in the AG Grid [Community version](https://github.com/ag-grid/ag-grid). Some features require a paid subscription to the AG Grid Enterprise version ([more info available here](https://www.ag-grid.com/license-pricing.php)). Both the community and enterprise versions are included in this component, but the enterprise features require you to provide a valid AG Grid license key. The demos which use Enterprise features are clearly marked. + + ### Documentation Please see the [Plotly Dash AG Grid Documentation](https://dash.plotly.com/dash-ag-grid). From 324da2d3fb9a7144b725fc7714f93053197eddbd Mon Sep 17 00:00:00 2001 From: BSd3v Date: Mon, 22 Jul 2024 14:28:10 -0400 Subject: [PATCH 10/20] fixing scrollTo issue with not resetting the prop after being used --- src/lib/fragments/AgGrid.react.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/fragments/AgGrid.react.js b/src/lib/fragments/AgGrid.react.js index 2cbde70..fe19896 100644 --- a/src/lib/fragments/AgGrid.react.js +++ b/src/lib/fragments/AgGrid.react.js @@ -1203,7 +1203,7 @@ export default class DashAgGrid extends Component { } } - scrollTo(reset = false) { + scrollTo(reset = true) { const {gridApi} = this.state; const {scrollTo, setProps, getRowId} = this.props; if (!gridApi) { From 484cce4f6317b154f4833916fb64018f6107462d Mon Sep 17 00:00:00 2001 From: BSd3v Date: Mon, 22 Jul 2024 14:29:46 -0400 Subject: [PATCH 11/20] fixing side issue exposed with `cellDoubleClicked` that was causing the grid to re-render --- src/lib/utils/propCategories.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/utils/propCategories.js b/src/lib/utils/propCategories.js index ca53124..051df2e 100644 --- a/src/lib/utils/propCategories.js +++ b/src/lib/utils/propCategories.js @@ -328,6 +328,7 @@ export const PROPS_NOT_FOR_AG_GRID = [ 'virtualRowData', 'cellValueChanged', 'cellClicked', + 'cellDoubleClicked', 'getRowRequest', 'getRowResponse', 'getDetailRequest', @@ -364,6 +365,7 @@ export const OMIT_PROP_RENDER = [ 'cellClicked', 'paginationInfo', 'cellRendererData', + 'cellDoubleClicked' ]; /** From a8fe0386e5ccef455f9f995a2645e59f69f31db4 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Mon, 22 Jul 2024 14:36:55 -0400 Subject: [PATCH 12/20] fixing for lint --- src/lib/utils/propCategories.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/utils/propCategories.js b/src/lib/utils/propCategories.js index 051df2e..d0e9205 100644 --- a/src/lib/utils/propCategories.js +++ b/src/lib/utils/propCategories.js @@ -365,7 +365,7 @@ export const OMIT_PROP_RENDER = [ 'cellClicked', 'paginationInfo', 'cellRendererData', - 'cellDoubleClicked' + 'cellDoubleClicked', ]; /** From df4b2a6d9757e50c59d39341d6c309ecf9d8d4b6 Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 22 Jul 2024 16:23:26 -0400 Subject: [PATCH 13/20] locking selenium in place for tests --- requires-dev.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requires-dev.txt b/requires-dev.txt index 644dbde..4945fa5 100644 --- a/requires-dev.txt +++ b/requires-dev.txt @@ -2,4 +2,5 @@ dash[ci,dev,testing]>=2.0 dash_mantine_components==0.12.1 pyyaml>=5.0 pytest<8.1.0 -wheel \ No newline at end of file +wheel +selenium<4.3.0 From 00853d3de120df1a7ea9b52a5cfd5de6510b417d Mon Sep 17 00:00:00 2001 From: BSd3v Date: Mon, 22 Jul 2024 16:33:45 -0400 Subject: [PATCH 14/20] updating changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91554a2..f47e02c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to `dash-ag-grid` will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/). Links "DE#nnn" prior to version 2.0 point to the Dash Enterprise closed-source Dash AG Grid repo +## unreleased +### Fixed + - [#314](https://github.com/plotly/dash-ag-grid/pull/314) + - locking selenium for tests that were failing due to missing import + ## [31.2.0] - 2024-02-25 ### Changed From 0b99adf102245727239676e43c56d5c1867f31a4 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Mon, 22 Jul 2024 16:35:19 -0400 Subject: [PATCH 15/20] updating changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f47e02c..1df3263 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Links "DE#nnn" prior to version 2.0 point to the Dash Enterprise closed-source D - [#314](https://github.com/plotly/dash-ag-grid/pull/314) - locking selenium for tests that were failing due to missing import + ## [31.2.0] - 2024-02-25 ### Changed From a49b5d675d5d1d1388db8405d6407b2c6ba4d599 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Tue, 23 Jul 2024 16:21:08 -0400 Subject: [PATCH 16/20] updating changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1df3263..3766810 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ Links "DE#nnn" prior to version 2.0 point to the Dash Enterprise closed-source D ### Fixed - [#314](https://github.com/plotly/dash-ag-grid/pull/314) - locking selenium for tests that were failing due to missing import + - [#313](https://github.com/plotly/dash-ag-grid/pull/313) + - fixing issue where `scrollTo` was defaulting to not reset the value + - fixing side issue where `cellDoubleClicked` was forcing the grid to rerender ## [31.2.0] - 2024-02-25 From 31ec0e279c673f4c76a8ff511d6ff8ad28e7a13c Mon Sep 17 00:00:00 2001 From: BSd3v Date: Tue, 23 Jul 2024 17:45:48 -0400 Subject: [PATCH 17/20] updating test to account for rerendering the grid and to make sure the grid maintains the currently scrolled position instead of jumping back to the previous location, regardlress of double clicking and also the grid rerendering --- tests/test_scroll_to.py | 45 +++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/tests/test_scroll_to.py b/tests/test_scroll_to.py index 073d294..1a8cba4 100644 --- a/tests/test_scroll_to.py +++ b/tests/test_scroll_to.py @@ -1,10 +1,11 @@ -from dash import Dash, html, Input, Output +from dash import Dash, html, Input, Output, Patch, State from dash_ag_grid import AgGrid import plotly.express as px import json from dash.testing.wait import until import pandas as pd import pytest +import time from . import utils @@ -20,9 +21,9 @@ def df(): def scroll_to_inputs(): return [ {"rowIndex": 100, "rowPosition": "bottom", "cell": (100, 0)}, - {"column": "bronze", "columnPosition": "end", "cell": (100, 8)}, - {"rowId": "Elizabeth Beisel12/8/2012", "rowPosition": "top", "cell": (200, 8)}, - {"rowIndex": 300, "rowId": 500, "cell": (300, 8)}, + {"rowIndex": 100, "column": "bronze", "columnPosition": "end", "cell": (100, 8)}, + {"rowId": "Elizabeth Beisel12/8/2012", "column": "bronze", "columnPosition": "end", "rowPosition": "top", "cell": (200, 8)}, + {"rowIndex": 300, "column": "bronze", "columnPosition": "end", "cell": (300, 8)}, { "rowIndex": 400, "rowId": "Ryan Bayley29/08/2004", @@ -86,6 +87,7 @@ def test_st001_scroll_to(dash_duo, df, scroll_to_inputs): getRowId="params.data.athlete+params.data.date", ), html.Button(id="btn"), + html.Button(id="btn_columnState"), html.Div(id="scrollTo-output"), html.Div(id="scrollTo-input"), ] @@ -97,7 +99,19 @@ def test_st001_scroll_to(dash_duo, df, scroll_to_inputs): Input("grid", "scrollTo"), ) def display_scrollTo(scroll_to): - return json.dumps(scroll_to) + if scroll_to: + return json.dumps(scroll_to) + + @app.callback( + Output('grid', 'columnState'), + Input('btn_columnState', 'n_clicks'), + State('grid', 'columnState'), + prevent_initial_call=True + ) + def reset_columnState(n, s): + state = Patch() + state[0]['width'] = s[0]['width'] - n+1 + return state # On click sets up a new value for scrollTo from the fixture scroll_to_inputs @app.callback( @@ -111,6 +125,8 @@ def update_scrollTo(n_clicks): dash_duo.start_server(app) grid = utils.Grid(dash_duo, "grid") + action = utils.ActionChains(dash_duo.driver) + # Check that the grid has been loaded successfully until(lambda: "Michael Phelps" == grid.get_cell(0, 0).text, timeout=3) @@ -119,7 +135,8 @@ def update_scrollTo(n_clicks): y, x = info["cell"] dash_duo.find_element("#btn").click() - dash_duo.wait_for_text_to_equal("#scrollTo-output", json.dumps(info), timeout=5) + # removing as this no longer works due to resetting the value, [#313](https://github.com/plotly/dash-ag-grid/pull/313) + # dash_duo.wait_for_text_to_equal("#scrollTo-output", json.dumps(info), timeout=5) until(lambda: grid.get_cell(y, x).is_displayed(), timeout=3) # row testing @@ -161,6 +178,22 @@ def update_scrollTo(n_clicks): if x - 1 >= 0: assert not grid.cell_in_viewport(y, x - 1) + # resets the grid + dash_duo.driver.execute_script(""" + dash_ag_grid.getApi('grid').ensureIndexVisible(0); + dash_ag_grid.getApi('grid').ensureColumnVisible('athlete'); + """) + until(lambda: grid.get_cell(0, 0).is_displayed(), timeout=3) + # make sure grid doesnt change upon double-click + action.double_click(grid.get_cell(0, 0)).perform() + time.sleep(1) + until(lambda: grid.get_cell(0, 0).is_displayed(), timeout=3) + # make sure scroll doesnt fire upon triggered reload by columnState + dash_duo.find_element("#btn_columnState").click() + time.sleep(1) + until(lambda: grid.get_cell(0, 0).is_displayed(), timeout=3) + + def test_st002_initial_scroll_to(dash_duo, df): app = Dash() From 0fec0b2657db1101180429fc95ba04b741095a11 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Wed, 24 Jul 2024 11:10:55 -0400 Subject: [PATCH 18/20] having the initial `scrollTo` not reset the prop, but instead to allow for the props to reset when the others do. - added similar test for comparing the initial `scrollTo` --- src/lib/fragments/AgGrid.react.js | 2 +- tests/test_scroll_to.py | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/lib/fragments/AgGrid.react.js b/src/lib/fragments/AgGrid.react.js index fe19896..52a2b92 100644 --- a/src/lib/fragments/AgGrid.react.js +++ b/src/lib/fragments/AgGrid.react.js @@ -700,7 +700,7 @@ export default class DashAgGrid extends Component { } if (scrollTo) { - this.scrollTo(scrollTo); + this.scrollTo(false); propsToSet.scrollTo = null; } diff --git a/tests/test_scroll_to.py b/tests/test_scroll_to.py index 1a8cba4..052207a 100644 --- a/tests/test_scroll_to.py +++ b/tests/test_scroll_to.py @@ -213,11 +213,23 @@ def test_st002_initial_scroll_to(dash_duo, df): "rowPosition": "top", "column": "bronze", "columnPosition": "end", - }, + } ), + html.Button(id="btn_columnState"), ] ) + @app.callback( + Output('grid', 'columnState'), + Input('btn_columnState', 'n_clicks'), + State('grid', 'columnState'), + prevent_initial_call=True + ) + def reset_columnState(n, s): + state = Patch() + state[0]['width'] = s[0]['width'] - n + 1 + return state + dash_duo.start_server(app) grid = utils.Grid(dash_duo, "grid") @@ -238,3 +250,20 @@ def test_st002_initial_scroll_to(dash_duo, df): # column testing assert not grid.cell_in_viewport(y, x + 1) assert grid.cell_in_viewport(y, x - 1) + + action = utils.ActionChains(dash_duo.driver) + + # resets the grid + dash_duo.driver.execute_script(""" + dash_ag_grid.getApi('grid').ensureIndexVisible(0); + dash_ag_grid.getApi('grid').ensureColumnVisible('athlete'); + """) + until(lambda: grid.get_cell(0, 0).is_displayed(), timeout=3) + # make sure grid doesnt change upon double-click + action.double_click(grid.get_cell(0, 0)).perform() + time.sleep(1) + until(lambda: grid.get_cell(0, 0).is_displayed(), timeout=3) + # make sure scroll doesnt fire upon triggered reload by columnState + dash_duo.find_element("#btn_columnState").click() + time.sleep(1) + until(lambda: grid.get_cell(0, 0).is_displayed(), timeout=3) From 340112626209b1e66854734249f6653cd2a1eef1 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Wed, 24 Jul 2024 12:12:11 -0400 Subject: [PATCH 19/20] updating changelog to discuss maintaining scroll position during a grid rerender --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3766810..3446337 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,8 @@ Links "DE#nnn" prior to version 2.0 point to the Dash Enterprise closed-source D - [#314](https://github.com/plotly/dash-ag-grid/pull/314) - locking selenium for tests that were failing due to missing import - [#313](https://github.com/plotly/dash-ag-grid/pull/313) - - fixing issue where `scrollTo` was defaulting to not reset the value + - [#312](https://github.com/plotly/dash-ag-grid/issues/312) fixing issue where `scrollTo` was defaulting to not reset the value + - to maintain scroll position during a grid rerender, be sure to use `getRowId` - fixing side issue where `cellDoubleClicked` was forcing the grid to rerender From f3ebed08eb6092f96a15c3fd0367d74788396a83 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Fri, 27 Sep 2024 14:57:10 -0400 Subject: [PATCH 20/20] attempt to fix failing --- tests/test_column_drag.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_column_drag.py b/tests/test_column_drag.py index 080f0b6..15d5a49 100644 --- a/tests/test_column_drag.py +++ b/tests/test_column_drag.py @@ -128,6 +128,7 @@ def addGrid(n, s): return no_update dash_duo.start_server(app) + dash_duo.driver.set_window_size(1000, 1000) grid = utils.Grid(dash_duo, "topGrid") botGrid = utils.Grid(dash_duo, "bottomGrid")