Describe the bug
Most of the AGGrid callbacks do not provide a static row ID. The rowIndex or startRow/endRow that is provided is the row number on the UI layer. If the user has sorted or filtered the grid in the UI, this rowIndex no longer points to the original row in the backend.
The one callback that does this correctly is on_cell_value_changed, which provides a node_id that points to the original row. If the AGGrid is filtered or sorted, the rowIndex points to the current UI row and the node_id points to the row number of that row in the original data. That is what makes it possible to identify the cell in the source data and make the update.
As a result, callbacks like on_cell_selection_changed are impossible to use, because you cannot locate the original row from the data.
An example use-case is using on_cell_selection_changed to cross-filter another chart, a common thing to do with BI tools like PowerBI. For example, I want to use an AGGrid of customers to cross-filter the items that a customer purchased, which are displayed on another table. I need to identify the customer ID from the row a user clicked. But if the rows have changed order because the viewer sorted them, I cannot reliably identify which customer they clicked.
To Reproduce
This can be seen in the example on the Reflex website: https://reflex.dev/docs/enterprise/ag-grid/cell-selection/#range-selection.
By default, Michael Phelps (Age 23) is in Row 0:
Next, sort by Athlete, and then click Michael Phelps (Age 23).
You see that the callback returns a reference to row 3, which is where Michael Phelps (Age 23) is currently in the UI. But there is no reference to Row 0, the original backend row.
With this behavior, there is no ready way for the backend to know that the user clicked Michael Phelps (Age 23). Most likely, the backend will process this as a click on Natalie Coughlin, who was originally in row 3.
Expected behavior
All AGGrid on_cell_.... and on_row_.... callbacks should provide a node_id field for the backend to identify the original row(s), not just the UI row(s).
Alternately, provide the full row data in the callback. Then, we can include our own row_index in the data, which we can use to identify the actual row(s) the user is interacting with.
If there is an existing way to handle this, please add it to the docs.
Specifics (please complete the following information):
- Python Version: 3.12
- Reflex Version: 0.9.2
- OS: Linux (Ubuntu on WSL) & Docker Alpine
- Browser (Optional): Chrome
Describe the bug
Most of the AGGrid callbacks do not provide a static row ID. The
rowIndexorstartRow/endRowthat is provided is the row number on the UI layer. If the user has sorted or filtered the grid in the UI, thisrowIndexno longer points to the original row in the backend.The one callback that does this correctly is
on_cell_value_changed, which provides anode_idthat points to the original row. If the AGGrid is filtered or sorted, therowIndexpoints to the current UI row and thenode_idpoints to the row number of that row in the original data. That is what makes it possible to identify the cell in the source data and make the update.As a result, callbacks like
on_cell_selection_changedare impossible to use, because you cannot locate the original row from the data.An example use-case is using
on_cell_selection_changedto cross-filter another chart, a common thing to do with BI tools like PowerBI. For example, I want to use an AGGrid of customers to cross-filter the items that a customer purchased, which are displayed on another table. I need to identify the customer ID from the row a user clicked. But if the rows have changed order because the viewer sorted them, I cannot reliably identify which customer they clicked.To Reproduce
This can be seen in the example on the Reflex website: https://reflex.dev/docs/enterprise/ag-grid/cell-selection/#range-selection.
By default, Michael Phelps (Age 23) is in Row 0:
Next, sort by Athlete, and then click Michael Phelps (Age 23).
You see that the callback returns a reference to row 3, which is where Michael Phelps (Age 23) is currently in the UI. But there is no reference to Row 0, the original backend row.
With this behavior, there is no ready way for the backend to know that the user clicked Michael Phelps (Age 23). Most likely, the backend will process this as a click on Natalie Coughlin, who was originally in row 3.
Expected behavior
All AGGrid
on_cell_....andon_row_....callbacks should provide anode_idfield for the backend to identify the original row(s), not just the UI row(s).Alternately, provide the full row data in the callback. Then, we can include our own row_index in the data, which we can use to identify the actual row(s) the user is interacting with.
If there is an existing way to handle this, please add it to the docs.
Specifics (please complete the following information):