DataTable - Single selection selects multiple with same row entries
I'm submitting a ... (check one with "x")
[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
Plunkr Case (Bug Reports) Please fork the plunkr below and create a case demonstrating your bug report. Issues without a plunkr have much less possibility to be reviewed.
http://plnkr.co/edit/IVtaaLJDkaMUH4PirGCf?p=preview
Current behavior
I am using single selection in DataTable. If I have two rows with equal column values, the selection selects both rows instead of one. Please see the provided Plunk.
Expected behavior
It should select only the clicked row.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
- Angular version: 4.3.6
- PrimeNG version: 4.0.3
- Browser: [all]
-
Language: [TypeScript 2.3.0]
-
Node (for AoT issues):
node --version=
I've run into this same issue. I can't speak to if this really is a "bug" or not but you can get around this by using the dataKey input property on the primeNG datatable. This will do the selection on the dataKey and not the content of the rows.
http://plnkr.co/edit/te8mSK0U1NnBoj4U0xOH?p=preview
The way the datatable works without the key is that it does a selection check on the objects and if all the properties of the object are the same it selects the row as the same object. I am not sure how they get around that unless they do a different object check or something like that.
Exactly as above comment.