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 - How to make rows disabled in order not to be selected when clicking on the SelectAll checkbox? #6972

Closed
1 of 2 tasks
zbeedatm opened this issue Oct 5, 2020 · 5 comments

Comments

@zbeedatm
Copy link

zbeedatm commented Oct 5, 2020

What package(s) are you using?

  • carbon-components
  • carbon-components-react

Summary

I disabled the <TableSelectRow> but when clicking on SelectAll these rows are selected, and I need them to be unselected.

Relevant information

Tried to apply the disabled attribute to <TableRow> but it didn't help!
Note: I have a menu near the name of the row with "Info" option, so disabling the row might block this functionality -which is not wanted-

<TableBody> {rows.map(row => ( <TableRow key={row.id}> <TableSelectRow {...getSelectionProps({ row, onClick: event => { //console.log(row.id, event.target.checked); this.selectRule(row.id, event.target.checked) } }) } disabled={this.state.unattachedRulesTables[row.id] && this.state.unattachedRulesTables[row.id].length > 0}/> {row.cells.map(cell => ( <TableCell key={cell.id}>{cell.value}</TableCell> ))} </TableRow> ))} </TableBody>

@zbeedatm zbeedatm changed the title DataTable - how to make some of the rows disabled? DataTable - How to make rows disabled in order not to be selected when clicking on the SelectAll checkbox? Oct 5, 2020
@tw15egan
Copy link
Collaborator

Hey there @zbeedatm, it seems like this may have been fixed as I am unable to reproduce your experience.

table-select

Going to close this as resolved, but feel free to comment here if you're still experience issues and I'll go ahead and reopen this.

@enriqueavilac
Copy link

enriqueavilac commented Sep 14, 2021

@tw15egan Can you share the code of the example that you show? I have the same problem as @zbeedatm and I coudn't reproduce your solution.

@OmranAbazid
Copy link

I had the same issue and It seems that adding a disabled attribute to the row object will make it work correctly.

@SaloniRathi
Copy link

Hi @OmranAbazid ,
can you please share the code.

@OmranAbazid
Copy link

OmranAbazid commented Feb 28, 2024

@SaloniRathi
It would be something like this:

<DataTable
        rows={[{...yourRowProperties, disabled: true}]}
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

5 participants