question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SubItem is placed under wrong header after change of item

See original GitHub issue

I have a list with sticky headers.

After inital load I have two headers: OVERDUE

  • “Test 3” with date yesterday
  • “Today 8” with date yesterday

TODAY

  • “Test 4” with date today
  • “Test 5” with date today
  • “Test 6” with date today

Now I edit the item “Test 4” and change the date to yesterday. The data will be fetched again from the database and I create the list for the adapter.

The list will be added to the adapter with “updateDataSet” and the list contains this items as of my logs.:

Creating new HeaderItem: Overdue Adding SubItem 3/Test 4 to Header Overdue Adding SubItem 2/Test 3 to Header Overdue Adding SubItem 7/Today 8 to Header Overdue Adding HeaderItem to list: Overdue

Creating new HeaderItem: Today Adding SubItem 4/Test 5 to Header Today Adding SubItem 5/Test 6 to Header Today Adding HeaderItem to list: Today

Reminder List contains 2 items!

Seems all correct and the edited item is also updated with the correct date, BUT the list looks now like this: OVERDUE

  • “Test 3” with date yesterday
  • “Today 8” with date yesterday

TODAY

  • “Test 4” with date yesterday
  • “Test 5” with date today
  • “Test 6” with date today

So did I miss something? Do I need a refresh of the headers or something?

For the HeaderItem I extend AbstractExpandableHeaderItem. For the SubItems I extend AbstractSectionableItem.

After restart of the app the list is again correct.

Update: Here the logs from FlexibleAdapter. Seems also correct as of the logs:

09-05 08:02:23.546 21953-21953/com.colapps.reminder V/FlexibleAdapter: onViewBound    Holder=ActiveReminderHeaderViewHolder position=0 itemId=573358208
09-05 08:02:23.551 21953-21953/com.colapps.reminder V/FlexibleAdapter: onViewBound    Holder=ActiveRemindersViewHolder position=1 itemId=50
09-05 08:02:23.569 21953-21953/com.colapps.reminder V/FlexibleAdapter: onViewBound    Holder=ActiveRemindersViewHolder position=2 itemId=55
09-05 08:02:23.572 21953-21953/com.colapps.reminder V/FlexibleAdapter: onViewBound    Holder=ActiveReminderHeaderViewHolder position=3 itemId=80981793
09-05 08:02:23.573 21953-21953/com.colapps.reminder V/FlexibleAdapter: onViewBound    Holder=ActiveRemindersViewHolder position=4 itemId=51
09-05 08:02:23.577 21953-21953/com.colapps.reminder V/FlexibleAdapter: onViewBound    Holder=ActiveRemindersViewHolder position=5 itemId=52
09-05 08:02:23.601 21953-21953/com.colapps.reminder V/FlexibleAdapter: onViewBound    Holder=ActiveRemindersViewHolder position=6 itemId=53

Another Update: If I collapse “Today” the item “Test 4” is now listed at the bottom. If I collapse “Overdue” and expand it again the item “Test 4” is now correctly displayed under “Overdue”.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisonlinecommented, Sep 7, 2017

Ok thanks for your great support and your awesome library!

0reactions
davideascommented, Sep 7, 2017

@chrisonline, equals is used by Collections based on List, hashCode by Collections based on Hash, necessary to identify the item during the scan to pick it up / remove / update etc… But this is Java concept. In the Adapter both collections are used.

I’ve added a method IFlexible.shouldNotifyChange(newItem) (similar to DiffUtil concept) that checks if the Item must be really updated or skipped, inside there you can evaluate all the others fields. By default it returns true.

The cursor should return only the Expandables as per requirement explained in the Wiki headers and sections. So you have to move the subItem from the subList in order to add it to the other subList before providing the newList of only expandables to the adapter.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The subitems - monday.com Support
Subitems provide your board with a deeper structure by letting you add an extra layer of information within the items on your board!...
Read more >
Why does the ListView refuse to display its columns, items ...
I changed my code in the form's Load event from: var colHeadName = new ColumnHeader { Text = Resources.
Read more >
ListViewItem.UseItemStyleForSubItems Property
Gets or sets a value indicating whether the Font, ForeColor, and BackColor properties for the item are used for all its subitems.
Read more >
How to make a menu item that is not a link
It will move the sub-item under the main header. Repeat this step for all of your sub-items and click "Save" when finished to...
Read more >
make the header material of a sales set BOM a non stock
I have been able to create the delivery now based on the STO, but the concern is SAP expect the header material to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found