-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Unable to delete rows, as duplicate IDs are getting created #495
Comments
Ok thanks for the hint even though users will never (at least they shouldn't) use this piece of code as it's only for demo purposes, however your code change doesn't seem to work correctly. A better fix is to find the highest Id of the dataset and increment by 1, that is what I've done in the PR #497, I'm also pulling latest dataset from the DataView so it's updated. |
Thanks for looking into it :) |
This is now fixed in latest version 2.19.x. Please upvote ⭐ if you haven't already. |
General Topic
Your Environment
Context or Topic
Slickgrid has existed since long, but doing it the Angular way was
really fun. Thanks to the Team.
I was trying out the feature of add / update
https://ghiscoding.github.io/Angular-Slickgrid/#/additem and
its really cool. But some how it was generating duplicate IDs as a
result of which I was not able to delete the rows. I was going through
its demo component
https://github.com/ghiscoding/Angular-Slickgrid/blob/master/src/app/examples/grid-additem.component.ts
and figured in line no: 167
const newId = this.dataset.length;
. Iunderstand its a very minor issue but newbie might struggle a bit at
start if they follow the Demo component.
Expected Behavior
Should generate unique IDs.
Current Behavior
Row IDs are repeating. I have attached a gif for the same.
Possible Solution
Could use a min heap to get the missing IDs.
But we can simply use the below as we just need to mention some unique ID:
let length = this.dataset.length;
let id = (length === 0) ? len : this.dataset[length-1].id + 1
The text was updated successfully, but these errors were encountered: