Skip to content

Commit c31abc2

Browse files
cellOnClick change
1 parent 9fa63fa commit c31abc2

3 files changed

Lines changed: 59 additions & 0 deletions

File tree

content/workspace/developers/json-specs/widgets-json-reference.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ A `Widgets.json` table is a configuration structure with any of the named attrib
320320
_Example:_ `"id"`
321321
_Example use case:_ If your table displays company names in the cell but your API expects company IDs, set `valueField: "companyId"` to use the ID field from the row data instead of the displayed name.
322322

323+
- **forceUpdate**
324+
_Type:_ `boolean` (optional)
325+
By default, clicking a cell updates the shared parameter for the other widgets in the group, but the widget containing the clicked cell does not re-fetch its own data. Set this to `true` to force the source widget to update as well when one of its cells is clicked.
326+
_Example:_ `true`
327+
323328
- **colorValueKey**
324329
_Type:_ `string`
325330
Specifies which field to use for determining the color when showing cell changes.

content/workspace/developers/widget-configuration/render-functions.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,32 @@ In this example:
235235
]
236236
```
237237

238+
### Using forceUpdate to Refresh the Source Widget
239+
240+
By default, when a cell click updates a parameter through the `groupBy` action, only the other widgets that share the parameter are refreshed — the widget containing the clicked cell does not re-fetch its own data. If the source widget also uses the parameter (for example, the table filters or highlights rows based on the selected symbol), set `forceUpdate: true` so it updates too:
241+
242+
```json
243+
{
244+
...
245+
"columnsDefs": [
246+
{
247+
"field": "symbol",
248+
"headerName": "Symbol",
249+
"renderFn": "cellOnClick",
250+
"renderFnParams": {
251+
"actionType": "groupBy",
252+
"groupBy": {
253+
"paramName": "symbol",
254+
"forceUpdate": true
255+
}
256+
}
257+
}
258+
]
259+
}
260+
```
261+
262+
With `forceUpdate: true`, clicking a symbol cell updates the `symbol` parameter and re-fetches the table widget's own data in addition to updating the other widgets in the group.
263+
238264
### Hover Card
239265

240266
To use the hover card render function, you need to add it to the `columnsDefs` array in your `widgets.json` file for the column you want to apply it to.

content/workspace/developers/widget-parameters/cell-click-grouping.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,31 @@ In this example:
229229
- When displaying human-readable text but needing to pass IDs or codes
230230
- When the displayed value differs from the parameter value format
231231
- When you want to decouple the display value from the API parameter value
232+
233+
## Using forceUpdate to Refresh the Source Widget
234+
235+
By default, clicking a cell only updates the other widgets that share the parameter — the table widget containing the clicked cell does not re-fetch its own data. This avoids unnecessary requests, since the table usually just provides the selection.
236+
237+
If the table widget itself also depends on the parameter (for example, it filters or highlights its rows based on the selected symbol), set `forceUpdate: True` in the `groupBy` configuration so the source widget re-fetches its data as well:
238+
239+
```python
240+
{
241+
"field": "symbol",
242+
"headerName": "Symbol",
243+
"cellDataType": "text",
244+
"width": 120,
245+
"renderFn": "cellOnClick",
246+
"renderFnParams": {
247+
"actionType": "groupBy",
248+
"groupBy": {
249+
"paramName": "symbol",
250+
"forceUpdate": True # Also re-fetch this widget's data on click
251+
}
252+
}
253+
}
254+
```
255+
256+
**When to use forceUpdate:**
257+
258+
- When the table widget's own endpoint uses the parameter being updated
259+
- When clicking a cell should refresh the data shown in the source table, not just the connected widgets

0 commit comments

Comments
 (0)