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

Remove section not working as I expect #607

Closed
steventxc opened this issue May 7, 2018 · 3 comments
Closed

Remove section not working as I expect #607

steventxc opened this issue May 7, 2018 · 3 comments

Comments

@steventxc
Copy link

As document says
To remove a section: You can delete the header item with removeItem(getGlobalPositionOf(header));

but when i want to remove a section, followed above instruction, just removed the header item only, not removed the section items belong to the header,.
do i need to remove the section items manually?

@davideas
Copy link
Owner

davideas commented May 7, 2018

@steventxc, no indeed the documentation is a bit wrong. it deletes only the section header.
I can add a shortcut function to remove all the items of the sections, with removeSection(). In the meantime you have to remove yourself the items.

@steventxc
Copy link
Author

steventxc commented May 8, 2018

List<Integer> ids = mAdapter.getSectionItemPositions(mHeaderItem);
// also add header position
ids.add(mAdapter.getGlobalPositionOf(header));
mAdapter.removeItems(ids);

@davideas I used this code solve my problem, thanks

@davideas
Copy link
Owner

davideas commented May 8, 2018

@steventxc, very good, indeed, the new removeSection will do something similar to that, but I will have to make it working also for expandable headers. I will publish this in 5.0.5.

@davideas davideas changed the title remove section not work as I expect Remove section not working as I expect May 8, 2018
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