Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant