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

I could not start with all rows

Open charles-braga-unvoid opened this issue 1 year ago • 1 comments

Issue Check list

  • [X] Agree to the Code of Conduct
  • [X] Read the README
  • [X] You are using React 16.8.0+
  • [X] You installed styled-components
  • [X] Include relevant code or preferably a code sandbox

Describe the bug

I can't start the table with all items being shown. I'm using version "^7.5.3" because in ^7.6.2 the paginationPerPage is not working.

Expected behavior

I would like it if, whenever I wanted, I could start the table with the option of all items being showed.

Relevant Code

<DataTable
            columns={columns}
            data={data}
            subHeader
            subHeaderComponent={subHeaderComponent}
            defaultSortFieldId={1}
            defaultSortAsc={false}
            striped
            highlightOnHover
            onRowClicked={selectionChanged}
            pagination
            paginationRowsPerPageOptions={PAGINATION_ROWS}
            paginationComponentOptions={{ selectAllRowsItem: true }}
            paginationPerPage={rowsPerPage === 'all' ? filteredAssets.length : rowsPerPage} // that's the line
            onChangeRowsPerPage={handleRowsPerPageChange}
          />

There is no option to start with all rows displayed, so I put the dimension of my array in paginationPerPage to start the table.

However, if the array size is 0, the DataTable crashes, so I thought about adding a default value and, as I add new items, increase the table. But this doesn't work since it always remains at the initial value. If you start at 1 and then go to 2, the table continues to show only 1 item.

I try to add a very high value as a base, however in this away the "all" option does not appear in the footer.

Is there a solution to my problem?

charles-braga-unvoid avatar May 09 '24 19:05 charles-braga-unvoid

Hi, what is you see in the terminal into the version ^7.6.2 about the paginationPerPage

eric-net avatar Aug 30 '24 02:08 eric-net