Reputation: 1
I'm using Data Table from Prime React, the thing is that when I CheckAll and after that select a filter the selectedProducts doesnt update, they only do it when I unCheckAll and CheckAll again. Even though that when I export the CVS, it exports the rows that are filtered.
export default function DataTable() {
const [selectedProducts, setSelectedProducts] = useState<Product[]>([]);
return(
<div>
{setSelectedProducts.length !== 0 && (
<CButton
color="primary"
size="md"
onClick={() => setShowSendModal(true)}
Send{selectedRows.length} Offer
</CButton>
)}
</div>
<DataTable
onSelectionChange={(e) => {
if (Array.isArray(e.value)) {
setSelectedProducts(e.value);
}
}}>
..........
.......
......
<Column
selectionMode="multiple"
headerStyle={{ width: '3rem' }}
className="py-4 px-3 justify-content-center"
/>
);
I've tried to force the rerendering of the object, but I think the problem is that when filter is applied, selectedProducts is not setted. Maybe because it doesn't call the onChangeSelection.
Upvotes: 0
Views: 84