jbetancur / react-data-table-component

A responsive table library with built-in sorting, pagination, selection, expandable rows, and customizable styling.
https://react-data-table-component.netlify.app
Apache License 2.0
2.03k stars 409 forks source link

I could not start with all rows #1232

Open charles-braga-unvoid opened 3 months ago

charles-braga-unvoid commented 3 months ago

Issue Check list

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?

eric-net commented 3 days ago

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