Groupie: Remove children from expandable group

Created on 7 Oct 2017  路  3Comments  路  Source: lisawray/groupie

I'm opening this question gain since #107 was closed without a solution.

I couldn't manage to tie together the ExpandableGroup with the UpdatingGroup to add/remove items from a group.

Any help will be wellcome!

Thanks

Most helpful comment

Wish I came across this sooner! For anyone else in a similar situation:

It looks like UpdatingGroup is now deprecated, and replaced by Sections. The Kotlin example (non-databinding) includes an example of removing items from a Section by swipe. As Lisa mentioned, you can add the Section directly to your adapter, or to an ExpandableGroup.

I was following the databinding example, where child groups were directly added to the ExpandableGroup. It wasn't until later that I tried removing groups, and realized ExpandableGroup doesn't support this. You also can't override the remove method, since the children list in ExpandableGroup is private and not protected. I ended copying ExpandableGroup into a new class, where remove() is implemented, but this is not the correct way.

I think it might be helpful to clarify this in the documentation, perhaps even with this specific example (add a Section which can be updated, to an ExpandableGroup which does not support removing items). The library itself is fantastic, as long as it's used properly.

All 3 comments

I'm not sure exactly what you're trying to achieve, but it's possible that it's related to this bug. https://github.com/lisawray/groupie/issues/124

Generally, if I expect updates to the contents of an ExpandableGroup, I add an UpdatingGroup as its only child and put all the expanded content into the UpdatingGroup directly. Does that help?

Wish I came across this sooner! For anyone else in a similar situation:

It looks like UpdatingGroup is now deprecated, and replaced by Sections. The Kotlin example (non-databinding) includes an example of removing items from a Section by swipe. As Lisa mentioned, you can add the Section directly to your adapter, or to an ExpandableGroup.

I was following the databinding example, where child groups were directly added to the ExpandableGroup. It wasn't until later that I tried removing groups, and realized ExpandableGroup doesn't support this. You also can't override the remove method, since the children list in ExpandableGroup is private and not protected. I ended copying ExpandableGroup into a new class, where remove() is implemented, but this is not the correct way.

I think it might be helpful to clarify this in the documentation, perhaps even with this specific example (add a Section which can be updated, to an ExpandableGroup which does not support removing items). The library itself is fantastic, as long as it's used properly.

closing as this functionality exists in ExpandableGroup

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nimrodda picture Nimrodda  路  3Comments

kolmakovruslan picture kolmakovruslan  路  3Comments

mattinger picture mattinger  路  3Comments

forntoh picture forntoh  路  3Comments

jordond picture jordond  路  6Comments