From 12ccdf02176061bee77d409d8be01972f6e6658b Mon Sep 17 00:00:00 2001 From: Adrian Borrmann Date: Fri, 1 Aug 2025 12:20:19 -0600 Subject: [PATCH 1/4] allow cellRenderer to be a fn in a colDef --- CHANGELOG.md | 5 ++++ src/lib/utils/propCategories.js | 1 + tests/test_column_defs.py | 49 +++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 tests/test_column_defs.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 283860ec..dde1f9a9 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 +## [32.3.1] - 2025-08-05 + +### Fixed +- [#394](https://github.com/plotly/dash-ag-grid/issues/394) allow `cellRenderer` column def to be a function + ## [32.3.0] - 2025-07-23 ### Changed diff --git a/src/lib/utils/propCategories.js b/src/lib/utils/propCategories.js index 20ef56d0..a2f8cf06 100644 --- a/src/lib/utils/propCategories.js +++ b/src/lib/utils/propCategories.js @@ -230,6 +230,7 @@ export const COLUMN_MAYBE_FUNCTIONS = { cellStyle: 1, cellClass: 1, tooltipComponent: 1, + cellRenderer: 1, cellRendererSelector: 1, // Columns: Row Dragging diff --git a/tests/test_column_defs.py b/tests/test_column_defs.py new file mode 100644 index 00000000..3558c7ba --- /dev/null +++ b/tests/test_column_defs.py @@ -0,0 +1,49 @@ +import dash_ag_grid as dag +from dash import Dash, html, dcc +from . import utils + + +def test_cd001_cell_renderer_function(dash_duo): + app = Dash(__name__) + + rowData = [ + {"size": 0, "is_available": True}, + {"size": 1, "is_available": False}, + {"size": 2, "is_available": True}, + ] + + columnDefs = [ + { + "field": "size", + "cellRenderer": {"function": "params.value < 1 ? 'small' : params.value < 2 ? 'medium' : 'large'"}, + }, + { + "field": "is_available", + "cellRenderer": {"function": "params.value ? 'yes' : 'no'"}, + }, + ] + + app.layout = html.Div( + [ + dcc.Markdown( + "This grid uses a javascript function to display computed values for each cell, rather than the raw numbers." + ), + dag.AgGrid( + columnDefs=columnDefs, + rowData=rowData, + id="grid", + ), + ], + style={"margin": 20}, + ) + + dash_duo.start_server(app) + + grid = utils.Grid(dash_duo, "grid") + + grid.wait_for_cell_text(0, 0, "small") + grid.wait_for_cell_text(0, 1, "yes") + grid.wait_for_cell_text(1, 0, "medium") + grid.wait_for_cell_text(1, 1, "no") + grid.wait_for_cell_text(2, 0, "large") + grid.wait_for_cell_text(2, 1, "yes") From a5b301aa9e5d355538045202a2069589458d2ae1 Mon Sep 17 00:00:00 2001 From: Adrian Borrmann Date: Tue, 5 Aug 2025 09:19:26 -0600 Subject: [PATCH 2/4] update github workflow to run tests on backport branches --- .github/workflows/python-test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 68cbb152..2073f9cd 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -9,7 +9,9 @@ on: tags: - v* pull_request: - branches: [main] + branches: + - main + - v* jobs: test: @@ -104,4 +106,3 @@ jobs: run: | source .venv/bin/activate pytest --headless - From 972d23db3519330766d97de8eb9fa8862f60bc7a Mon Sep 17 00:00:00 2001 From: Adrian Borrmann Date: Tue, 5 Aug 2025 09:28:18 -0600 Subject: [PATCH 3/4] v32.3.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8a578a5f..94b66d97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dash-ag-grid", - "version": "32.3.0", + "version": "32.3.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "dash-ag-grid", - "version": "32.3.0", + "version": "32.3.1", "license": "MIT", "dependencies": { "@emotion/react": "^11.11.3", diff --git a/package.json b/package.json index 43d85e61..2eacb361 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dash-ag-grid", - "version": "32.3.0", + "version": "32.3.1", "description": "Dash wrapper around AG Grid, the best interactive data grid for the web.", "repository": { "type": "git", From f9ee3d0f0d56524cbcd639856e4530ea862e6597 Mon Sep 17 00:00:00 2001 From: Adrian Borrmann Date: Tue, 5 Aug 2025 10:27:02 -0600 Subject: [PATCH 4/4] v33.3.2rc1 --- CHANGELOG.md | 5 +++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fcdff04..07dedfe3 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 +## [32.3.2rc1] - 2025-08-05 + +### Fixed +- [#394](https://github.com/plotly/dash-ag-grid/issues/394) allow `cellRenderer` column def to be a function + ## [32.3.1] - 2025-08-05 ### Fixed diff --git a/package-lock.json b/package-lock.json index d3d3008b..fa2aa03c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dash-ag-grid", - "version": "33.3.2rc0", + "version": "33.3.2rc1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "dash-ag-grid", - "version": "33.3.2rc0", + "version": "33.3.2rc1", "license": "MIT", "dependencies": { "@emotion/react": "^11.11.3", diff --git a/package.json b/package.json index be055b9d..c30b4369 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dash-ag-grid", - "version": "33.3.2rc0", + "version": "33.3.2rc1", "description": "Dash wrapper around AG Grid, the best interactive data grid for the web.", "repository": { "type": "git",