Open ketain opened 5 years ago
The same issue in v5.1.0. At first I use updateDataSet (headers are displayed) and after I call onLoadMoreComplete (No headers on newly inserted items)
It seems that addItems->showOrUpdateHeaders only updates already added headers but skips new one. When I use suggested fix from @ketain it works.
override fun onLoadMoreComplete(newItems: List<T>?) {
val itemsWithHeaders = newItems?.toMutableList() ?: mutableListOf()
prepareItemsForUpdate(itemsWithHeaders)
super.onLoadMoreComplete(itemsWithHeaders)
}```
prepareItemsForUpdate(itemsWithHeaders)
this is a private function how wil you call this?
I know that you have answered similar questions on #271 and #183. But I think there is still a problem.
Using the method updateDataSet() properly displays all items with headers. Changing nothing else in the code but exchanging the call from updateDataSet() to onLoadMoreComplete() causes headers to not be displayed anymore.
In order to display the headers I had to copy this code from FlexibleAdapter.prepareItemsForUpdate into my own:
` int position = 0; IHeader sameHeader = null; while (position < items.size()) { IFlexible item = items.get(position);
`
(I slightly adapted the names to the ones used in my own code, of course)
This unfortunatley breaks the sticky header functionality, as none of the newly loaded items are being displayed. In their sted some of the old ones are shown.
I believe this has something to do with them not being added to the list of sticky headers?
I use version: v5.1.0