Skip to content
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

How do we delete an item from list after the adapter is filtered? #565

Closed
ch4ndu opened this issue Mar 9, 2018 · 4 comments
Closed

How do we delete an item from list after the adapter is filtered? #565

ch4ndu opened this issue Mar 9, 2018 · 4 comments

Comments

@ch4ndu
Copy link

ch4ndu commented Mar 9, 2018

Step 1. Have around 20 items in the adapter created initially.
Step 2. Then apply filter so that less items(10?) remain
Step 3. Remove an item from the adapter - ex: adpater.removeitem(2)
Step 4. Clear the filter.

The item removed here shows up in the list again after clearing the the filter. Is there any way I can make that deletion stick?

@davideas
Copy link
Owner

davideas commented Mar 9, 2018

@ch4ndu

  • Do you use the Undo or the Permanent delete?
  • Does it occurs before or after the undo is over?
  • Do you invoke the filter providing a new list or use the internal list? filterItems acceps a list also.

@ch4ndu
Copy link
Author

ch4ndu commented Mar 10, 2018

Do you use the Undo or the Permanent delete?

Permanent delete

Do you invoke the filter providing a new list or use the internal list?

I'm using internal list at the moment.

filterItems acceps a list also.

Does this change the mOriginalList contained within? I think I'm encountering the issue because of the mOriginalList not being modified/deleted while using adapter.removeItem(int position) while it is filtered.

@davideas
Copy link
Owner

@ch4ndu, I think too. I missed that scenario from the day I have changed the filter.
Good catch. Thank you.

@ch4ndu
Copy link
Author

ch4ndu commented Mar 11, 2018

awesome...thanks for the quick fix!
If you are interested, here is my app with your library in it Play store Link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants