jQWidgets Forums

jQuery UI Widgets Forums Navigation Tabs Closeable tabs containing other widgets

This topic contains 2 replies, has 2 voices, and was last updated by  aoverton07 11 years, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Closeable tabs containing other widgets #28124

    snethert
    Participant

    When a tab is closed, it cleans out the body div in the DOM before firing the removed event.

    As a result, any jqWidgets used in the tab body are removed before they can be manually ‘destroyed’ by a handler.

    Does the tab component do any intelligent checking of the children of the body div upon closing? If not, will the undestroyed but removed widgets cause a memory leak in a single page app where many tabs are opened and closed over time (with dynamic tab contents and different ‘id’s for the widgets on each new tab)?

    I can see that there are bindings in the widgets, but are there data structures which will not be garbage collected if the widgets are removed from the DOM but not ‘destroyed’?

    (I guess this is as much a question about ‘destroy’ in jqWidgets as it is about tabs.)

    With the addition of a ‘removing’ event to your tab component, I could manually clean up the tab contents and destroy any dropdown lists, calendars, etc. in the tab bodies before the tab is closed and this wouldn’t be an issue.

    Closeable tabs containing other widgets #29309

    aoverton07
    Participant

    I am also curious about this functionality…..

    snethert,

    currently I do my destroying in the the function handler of the ‘removed’ event handler. I keep a consistent naming convention on the widgets inside the tab, then tack on an instanceCount to the end of the ID’s I save the instanceCount in the tab title, then retrieve it for the destroying in the event args passed by the removed event.

    So are you saying that this way of destroying the widgets inside the tab does not work?

    Closeable tabs containing other widgets #29310

    aoverton07
    Participant

    I have verified that destroying widgets and removing their bindings DOES NOT WORK when tyring to do so inside the ‘removed’ callback….Is there anyway to do this outside of creating your own custom close tab button?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.