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

ag-grid editing example throws error when editing #1217

Open
masenf opened this issue Feb 19, 2025 · 1 comment
Open

ag-grid editing example throws error when editing #1217

masenf opened this issue Feb 19, 2025 · 1 comment

Comments

@masenf
Copy link
Collaborator

masenf commented Feb 19, 2025

https://reflex.dev/docs/library/tables-and-data-grids/ag-grid/#editing

It seems the problem is in the state

class AGGridEditingState(rx.State):
    data: list[dict] = []

    @rx.event
    def load_data(self):
        _df = pd.read_csv(
            "https://raw.githubusercontent.com/plotly/datasets/master/gapminder2007.csv"
        )
        self.data = _df.to_dict("records")

    @rx.event
    def cell_value_changed(self, row, col_field, new_value):
        self._data_df.at[row, col_field] = new_value
        self.data = self._data_df.to_dict("records")
        yield rx.toast(
            f"Cell value changed, Row: {row}, Column: {col_field}, New Value: {new_value}"
        )

The _data_df is not a field on self, so it cannot be updated by cell_value_changed

Copy link

linear bot commented Feb 19, 2025

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

No branches or pull requests

1 participant