question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

All checkboxes in a group were checked when i check one row in group

See original GitHub issue

I’m submitting a …

[X ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior I have grouped data with checkboxes. When i check a checkbox in a row, all rows in the group get checked.

Expected behavior When i check one row in a group, only the checkbox of this row have to be checked

Reproduction of the problem Open https://stackblitz.com/edit/angular-ngx-table-chebox-bug. Expand a Group (female or male) and try to check a checkbox of a single row.

Our fix In template: <ngx-datatable ... [rowIdentity]="fixRowIdentity"> In component: const fixedRowIdentity = (x: any) => x

What is the motivation / use case for changing the behavior? I want to select single rows with checkboxes from different groups

  • Table version: 16.0.3

  • Angular version: 8.2.14

  • Browser: Chrome Version 80.0.3987.116 (Official Build) (64-bit)

  • Language: TS 3.5.3

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:12

github_iconTop GitHub Comments

2reactions
delbertooocommented, Feb 28, 2020

IMO this is caused by #1778

https://github.com/swimlane/ngx-datatable/commit/3372d63d579f3c27f8da542ce0c7b7df4b2d15c9#diff-d15e451d9c07f1930dee554115082076R771-R778

This introduced getRowExpandedIdx which internally uses rowIdentity. The default rowIdentity has a context-based side-effect. It behaves differently if it’s context tells, that the table is grouped. If rowIdentity thinks the table is grouped, it treats the given row as a group object {key: ..., value: []}. The getRowExpandedIdx functionality uses rowIdentity on row objects, even if the table is grouped, so rowIdentity tries to treat a row like a group object.

1reaction
clonixdevcommented, Mar 1, 2022

I fixed with this rowIdentity function: fixedRowIdentity(x: any) { if(x.key) return x.key; return x.id }

this check if have “key” attribute for groups and “id” for rows

Read more comments on GitHub >

github_iconTop Results From Across the Web

Check Checkboxes in Grouped Table Rows Only
So, in effect, I want the checkbox in each "grouping" row to only check the checkboxes that belong to its respective group. $(function()...
Read more >
Checkbox in group row depending on the group items
I have items in the datagrid and each of them contain a boolean value that is shown as a checkbox in the datarows,...
Read more >
How to add, copy and delete multiple checkboxes in Excel
To delete all checkboxes at a time, go to the Home tab > Editing group > Find & Select > Go To Special,...
Read more >
Checkbox - Ant Design
Checkbox component. When To Use. Used for selecting multiple values from several options. If you use only one checkbox, it is the same...
Read more >
How to select ALL checkboxes on visible cells in a repeating ...
Put a condition on the RG's checkboxes that when the master checkbox is checked, they should also be checked. Option2: Using states. Create...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found