Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14480] TiAPI: Fire 'remove' event when a view is removed from it's parent

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsCore
Labelsadd, event, eventlistener, events, remove, view, views
ReporterFokke Zandbergen
AssigneeUnknown
Created2013-07-03T15:02:35.000+0000
Updated2018-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).

Comments

  1. Shannon Hicks 2013-07-03

    This could get complicated with Ti.UI.ScrollableView children. Also, TableView/ListView rows.
  2. Fokke Zandbergen 2013-07-03

    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?

JSON Source