Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

returning id of row as additional return value in _on_cell_value_changed#71

Open
vineetbansal wants to merge 1 commit intoreflex-dev:mainfrom
vineetbansal:main
Open

returning id of row as additional return value in _on_cell_value_changed#71
vineetbansal wants to merge 1 commit intoreflex-dev:mainfrom
vineetbansal:main

Conversation

@vineetbansal
Copy link

@vineetbansal vineetbansal commented Feb 25, 2025

Thanks for the great plugin!

In my use case (and also seemingly for others as per issue #25), I need the row identifier to be made available to me for proper updates, not merely the visible row index. I believe this little change makes it available as an (additional) 4th return value for on_cell_value_changed, without breaking any old code.

Typical usage:

class GridState(rx.State):
    @rx.event
    def cell_value_changed(self, row_index, col_field, new_value, row_id):
        yield rx.toast(
            f"Cell value changed, Row ID: {row_id}, Column: {col_field}, New Value: {new_value}",
        )

...
@rx.page(route="/grid")
def grid() -> rx.Component:
    return ag_grid(
        ...
        row_id_key="id",
        on_cell_value_changed=GridState.cell_value_changed,

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant