tjerkw / Android-SlideExpandableListView

A better ExpandableListView, with animated expandable views for each list item
Apache License 2.0
1.98k stars 741 forks source link

State should be reset when dataset is invalidated or changed. #11

Open tjerkw opened 11 years ago

tjerkw commented 11 years ago

@grivos found a problem when datasets are reloaded or invalidated:

However, There is a problem if the data set is changed and the current state is invalid. You might want to make WrapperListAdapterImpl extend BaseAdapter, and then in AbstractSlideExpandableListAdapter - override notifyDataSetChanged() and reset the state there.

(we found this ins issue #2, which is closed now)

tjerkw commented 11 years ago

Wanted to solve it with:

registerDataSetObserver(new DataSetObserver() { ... } However If a user of the library would set its own datasetobserver it would break my listener. Since only one listener is allowed.

I think your (by grivos) solution is the correct one. It should also override notifyDataSetInvalidated() in that case.

Will look at this later.

Giorgi commented 11 years ago

This also result in another unexpected behavior: If the listview is expanded and an expended item is removed the previous item gets expanded. A workaround is to collapse the listview before removing the item.

Nath5 commented 10 years ago

Has there been any progress on this issue? My list rows have a button to delete the row, however when I remove a row from the underlying array adapter the state of the next row gets the state of the row that was deleted.