-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
What's the correct way to remove an item from a ListView data source #881
Comments
You should clone your original data source, this time with all of the original data minus the item you want to remove. Then pass that data source into ListView during the next render() pass. Look at the Movies example to learn more about dynamic Lists. |
@ide this does not work. See contrived example below:
As this oversized GIF shows, If I set a key on the ListView and update that key after deletion it works except the whole list scrolls to the top as @darylrowland mentions. A user who scrolls down a list to delete an item expects the list to maintain it's position. |
Ah, there is a solution! Instead of doing something like this:
one can define
or
depending on how |
Same problem. |
Regarding my comment above: My So in conclusion, if you screw up your It also works without setting a |
I am using this, item is deleting from the state,todoItemArray but not updating in list view DataSoruce.. the object not reaching to the datasource and doesn't renderRow as expected.. |
Not sure if this is the right place to ask, but couldn't find any mention of this in the docs...
I want to delete an item in a ListView. At the moment I'm refreshing the whole data source with the new list. Is there a better way of doing this? My issue is that once I refresh, the ListView loses its scroll position and jumps back to the top.
The text was updated successfully, but these errors were encountered: