-
Notifications
You must be signed in to change notification settings - Fork 65
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
Problem deleting and updating data #176
Comments
Well this is really strange, thanks for the report! |
I can see that, after the deletion, when _itemsChanged is called, there is a problem retrieving the correct index. I think that you can't rely on the items.# index, because I think it's the internal key polymer uses in the original array and it no longer matches the correct element. Even though, I tried to modify the index to the correct one while debugging, and still no luck. |
I think you can improve the index/item detection part with the following code:
Please note that this doesn't fix the issue, but I think it fixes the bad index retrieval. Also, I'm pretty sure the bug is related to the _cachedItems array. If I replace the binding in the iron-list with "items", the edit/delete bug is fixed... But obviously, filtering, and many other things get broken. |
I think I have managed to fix the problem. I am not sure if it may have some side effects, or performance is degraded in any way. It seems to work, even with filtering, sorting, etc... Also, I have added two lines to try to restore scroll position when a _resetData is invoked. I have attached two files: iron-data-table.html.txt --> the fixes are marked with LGE |
After deleting a row, all edits done to rows after the deleted one are not refreshed properly (usually don't refreshed at all, sometimes refreshing multiple rows (on some odd tests I did), or refreshing the last row when trying to update the penultimate).
The code:
Steps to reproduce:
Click edit on first row (for example). You can see the name is updated
Click delete on second row (for example). You can see the row is deleted
Click edit on any row. You can see nothing happens, unless it's the first row, or the penultimate.
There is a commented iron-list to check if the issue was with the inner iron-list or the iron-data-table. You can see that iron-list doesn't have this issue.
The text was updated successfully, but these errors were encountered: