react-data-table-component icon indicating copy to clipboard operation
react-data-table-component copied to clipboard

Support for filtration of pre selection.

Open rockyWal opened this issue 3 years ago • 0 comments

Hello team. First of all, thank you for this marvelous plugin. But I want support for filtering of pre-selected rows. Currently I'm having the pre-selected data table like this

                    <DataTable
                        columns={getColumns()}
                        data={filteredData}
                        selectableRows={true}
                        paginationComponentOptions={paginationComponentOptions}
                        onSelectedRowsChange={handleRowSelect}
                        pagination={true}
                        pointerOnHover={true}
                        noTableHead={true}
                        selectableRowSelected={rowSelectCritera}
                        selectableRowsComponent={CheckBoxCustom}
                        customStyles = {customStyles}
                    />

I'm passing the filtered data as the data for the table as mentioned in the document(https://react-data-table-component.netlify.app/?path=/docs/examples-filtering--filtering). But when I use the selectableRowSelected the selection I make in the filtered data is not preserved. It comes back to the pre selected state. Here's the rowSelectCritera function

const rowSelectCritera = useMemo(() => {
        return (row:any) => row.selected
    }, []);

Can you please suggest me how we can tackle this? Or point me to any link above problems is resolved.

rockyWal avatar Oct 17 '22 04:10 rockyWal