       @api.view.addRenderHook 'infoElements', (@renderTime.bind @)
       @api.view.data.on 'afterDescendantRemoved', (@onDescendantRemoved.bind @)
       @api.view.data.on 'afterDescendantAdded', (@onDescendantAdded.bind @)
+      @api.view.data.on 'beforeRowRemoved', (@onRowRemoved.bind @)
+      @api.view.data.on 'afterRowAdded', (@onRowAdded.bind @)
       @rowChanges = []
       @currentRow = null
       @api.view.on 'exit', () =>

          current
    _rebuildTreeTimes: (id) ->
      children = @api.view.data._getChildren id

      childTotalTimes = _.map children, (child_id) => @getRowData child_id, "treeTotalTime"
      rowTotalTime = @getRowData id, "rowTotalTime"
      totalTimes = _.compact ([rowTotalTime].concat childTotalTimes)
      totalTime = sum totalTimes
      @setRowData id, "treeTotalTime", totalTime

      childDailyTimes = _.map children, (child_id) => @getRowData child_id, "treeDailyTime"
      rowDailyTime = @getRowData id, "rowDailyTime"
      dailyTimes = _.compact ([rowDailyTime].concat childDailyTimes)
      dailyTime = @_combineDailyTimes.apply @, dailyTimes
      @setRowData id, "treeDailyTime", dailyTime

    rowTime: (row, range) ->
      if range?

# Time-tracking keeps track of the amount of time spent in each subtree.
# Clones are double-counted. This is a known bug and will not be fixed.
(() ->

  pad = (val, length, padChar = '0') ->
