       event: e
       ids: [data._id]
       model: data
+
+TemplateClass.destroyed = ->
+  _.each @collectionHookHandles, (handle) -> handle.remove()
 
 TemplateClass.events
   'click table.selectable tbody tr': (e, template) ->

  @editItem = editItem
  @deleteItem = deleteItem
  if collection
    @autorun -> collection.after.remove (userId, doc) -> removeSelection domNode, [doc._id]

  if settings.editOnSelect
    @autorun =>

  settings = @data.settings ?= {}
  @tableId = settings.id ? getNextId()
  @selectedIds = new ReactiveVar([])
  @collectionHookHandles = []
  configureSettings(@)

TemplateClass.rendered = ->
