From 043dbc814b553e164358e6a30d9c7412a6ed8c75 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Thu, 3 Oct 2024 13:28:52 -0400 Subject: [PATCH] adding `dash_clientside` to available functions in the grid by default --- CHANGELOG.md | 4 ++++ src/lib/fragments/AgGrid.react.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00e79d4..7835b6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ Links "DE#nnn" prior to version 2.0 point to the Dash Enterprise closed-source D - to maintain scroll position during a grid rerender, be sure to use `getRowId` - fixing side issue where `cellDoubleClicked` was forcing the grid to rerender +### Added + - [#330](https://github.com/plotly/dash-ag-grid/pull/330) Added `dash_clientside` to available functions for easier on-liner functions, esp. `eventListeners`. + - requested [#303](https://github.com/plotly/dash-ag-grid/issues/303) + ## [31.2.0] - 2024-02-25 diff --git a/src/lib/fragments/AgGrid.react.js b/src/lib/fragments/AgGrid.react.js index 57353de..4dc77ff 100644 --- a/src/lib/fragments/AgGrid.react.js +++ b/src/lib/fragments/AgGrid.react.js @@ -79,6 +79,8 @@ const xssMessage = (context) => { const NO_CONVERT_PROPS = [...PASSTHRU_PROPS, ...PROPS_NOT_FOR_AG_GRID]; +const dash_clientside = window.dash_clientside || {} + const agGridRefs = {}; apiGetters.getApi = (id) => agGridRefs[stringifyId(id)]?.api; @@ -1073,6 +1075,7 @@ export default class DashAgGrid extends Component { const parsedCondition = esprima.parse(funcString).body[0].expression; const context = { d3, + dash_clientside, ...customFunctions, ...window.dashAgGridFunctions, }; @@ -1083,6 +1086,7 @@ export default class DashAgGrid extends Component { const parsedCondition = esprima.parse(funcString).body[0].expression; const context = { d3, + dash_clientside, ...customFunctions, ...window.dashAgGridFunctions, setGridProps: this.props.setProps,