Hello, I have a question.
So let’s say I have the following setup:
export default function MyComponent({data}) {
const [filters, setFilters] = useState([]);
const hotSettings = {
///..,
filters: true,
afterFilter: (conditionsStack) => {
setFilters(conditionsStack[0].conditions);
}
}
return (
<HotTable data={data} settings={hotSettings} className="handsontable"
///...
/>
);
}
Basically, the data that I display in the table, is passed as props in a component whose role is to only display the handsontable.
If I filter this table, I save the filters in the state, inside the afterFilter hook.
My question is, in this situation, how do I re-apply my saved filters when the data
object changes?
I know I have to do something like this:
const tableFilters = formInstance.getPlugin('filters');
tableFilters.addCondition(filters);
tableFilters.filter();
But I am not sure where or when exactly.
Also, maybe my approach is wrong, if there is a better one, please let me know.
Thank you!