[TIMOB-14480] TiAPI: Fire 'remove' event when a view is removed from it's parent
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Core |
Labels | add, event, eventlistener, events, remove, view, views |
Reporter | Fokke Zandbergen |
Assignee | Unknown |
Created | 2013-07-03T15:02:35.000+0000 |
Updated | 2018-02-28T20:03:59.000+0000 |
Description
I would like to have a
remove
event fired when a view is removed from a parent, with the parent in e.parent
or e.source
.
This is particular useful if the removed view is provided by another controller and that controllers needs to cleanup.
Of course you could work around this by manually notifying the other controller that its view has been removed, but if it's a list of views you will need to keep references to all their providing controllers as well.
Just for the sake of feature symmetry... we could add add
as well, allowing the providing controller to keep track of who's using it's view, possibly resetting state when removed and then added again. Or even taking a property of the parent (e.g. Window title) and use it on the view (re-display title there).
This could get complicated with Ti.UI.ScrollableView children. Also, TableView/ListView rows.
Will that stop you? ;) Another thing might be what to if the parent gets removed from its own parent. It should go down the tree and fire the event I guess?