Replies: 1 comment
-
I personally have not used MRT in class components, but I think you will have to take into account that the on[State]Change props will have either a raw value in their updater, or a callback function expecting previous state. There is an example in the state management docs for how to write a function handler for this. Probably something like this? _setColumnFilters = (updater: MRT_Updater) => {
this.setState(updater instanceof Function ? updater(prevPagination) : updater)
};
render() {
return (
<MaterialReactTable
columns={columns}
data={data}
state={{ pagination }}
onColumnFiltersChange={_setColumnFilters}
/>
);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
How can i use onColumnFiltersChange in a react class component.
I try.
onColumnFiltersChange={this._setColumnFilters}
_setColumnFilters = (filters) => this.setState({columnFilters: filters});
but dont work, this.state.columnFilters not get de values.
thanks.
Beta Was this translation helpful? Give feedback.
All reactions