Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable: Select all checkbox on header row not working properly when scrollable is true #7258

Closed
skj-skj opened this issue Sep 27, 2024 · 1 comment · Fixed by #7268
Closed
Assignees
Labels
Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@skj-skj
Copy link
Contributor

skj-skj commented Sep 27, 2024

Describe the bug

When scrollable is true with some scrollHeight ex: 150px

select all checkbox won't work properly when there a item in a row just below the header row. apart from updating the select all checkbox it updates the row checkbox which is under the header row.

Reproducer

https://stackblitz.com/edit/vitejs-vite-ca7boz?file=src%2FApp.tsx

System Information

primereact: 10.8.3 => 10.8.3
react: ^18.3.1 => 18.3.1

Steps to reproduce the behavior

  1. Create a DataTable table with scrollable true, selectionMode="multiple" and scrollHeight="150px" and put some data more than 3 items.
  2. click on header row checkbox
  3. scroll down in DataTable until the first row is just below the header row.
  4. click on the header row checkbox again.

Expected behavior

after scrolling down and again clicking on the header row checkbox it should uncheck all checkbox in the row

@skj-skj skj-skj added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 27, 2024
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Sep 27, 2024
skj-skj added a commit to skj-skj/primereact that referenced this issue Sep 28, 2024
@melloware melloware added this to the 10.8.4 milestone Sep 28, 2024
@skj-skj
Copy link
Contributor Author

skj-skj commented Sep 28, 2024

workaround to use in version 10.8.3 or below:

by passthrough thead and update the z-index, in the below example I have used primeflex css class.

stackblitz for workaround

<DataTable
    // ...
    selectionMode="multiple"
    scrollable
    scrollHeight="150px"
    pt={{
      thead: { className: 'z-2' }, // workaround
    }}
    // ...
  >
    {/* ... */}
    <Column selectionMode="multiple"></Column>
    <Column field="code" header="Code"></Column>
    {/* ... */}
</DataTable>

@melloware melloware added the Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team label Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants