Cells not removed on reloadData when decreasing item quantity #77

Open
jfmorin opened this Issue Apr 21, 2012 · 2 comments

Comments

Projects
None yet
3 participants

jfmorin commented Apr 21, 2012

When setNeedsLayout is called the following call to reloadData will fail to remove extra cells if the item quantity has decreased (ex: by changing item quantity from 3 to 1).

Calls:

  1. layoutSubviews
  2. layoutSubviewsWithAnimation:
  3. loadRequiredItems
  4. setSubviewsCacheAsInvalid is called before multiple calls to cellForItemAtIndex:
  5. calls to cellForItemAtIndex: will call itemSubviews

The first call to itemSubviews will set _itemsSubviewsCacheIsValid to YES but other subviews are added. This will cause the next call to realodData to remove only the first cell from the superview rather than all of them.

This can be fixed by adding "[self setSubviewsCacheAsInvalid];" at the end of the loadRequiredItems method.

Great control! I really enjoy using it.
Jeff

Owner

gmoledina commented Apr 27, 2012

Good catch ! Thanks @jfmorin.
I'll add this in the code and close the issue once I push the changes (this weekend).

Krys90 commented May 21, 2012

sorry,
when I try to reload a grid, it disappears and does not show the grid with new data.
I tried all methods
also [reloadData]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment