Relative Content

Tag Archive for reactjstypescripttanstack-table

Can’t update columnFilters with new columnFilter with the same id but “empty” value using Tanstack Table

I have a problem with implementing manual column filters with react tanstack table. When clicking button to remove filter I call removeSelectedFilter, where I update ColumnFiltersState (I’ll leave the selectedFilters state here, because it has 0 impact on that issue). Firstly I filter previous ColumnFiltersState to get rid of object with id: filter.id and then I set the state to ...prev + new object with the same id: filter.id but value: []. Unfortunately state is not set to [...prev, {id: filter.id, value: []}] but []. I can see that in useColumnFilter custom hook in filters log and I have no idea why it’s the case…

tanstack table:custom sorting

I am creating a table with filters, with the following columns name | amount | unit price | total , I want to know how you could keep several columns filtered at the time and uncheck them so that they stop filtering type checkbox, also in the columns unit price | total I want to apply another type of filter, from lower price to higher and higher to lower.