Sencha Premium Member
Updating a TreeStore whose view is hidden
I'm working on an email app using ST 2.2, and recently ran into a fairly nasty bug. The app has a list of folders that starts out hidden, and slides into view on a button tap. If a folder model is changed via a call to set(), that folder disappears from the list.
Here's how it happens:
- the call to set() triggers a call to Store::afterEdit()
- which calls Collection::replace() on the data to replace the old record with the new one
- the old record is removed
- the new one is not added because the record gets filtered out by a default filter that checks
whether the node is visible
When the list is shown later, the node is gone and there's no check to see if a node that was filtered out
has now become visible.
My current workaround is to override applyFilters() with a default filter that returns true. Would it be
better to do something like sync the store when the list is shown?
here's an idea i'm just going to throw out there: maybe suspendEvents() on the store when it is hidden, and resumeEvents() when it's shown?
Tags for this Thread