     templateTasksCleaningTable: require './templates/tasksCleaningTable'
 
     killTaskTemplate: require './templates/vex/killTask'
+
+    events:
+        'click [data-action="viewJSON"]': 'viewJson'
+        'click [data-action="remove"]': 'removeTask'
+        'click [data-action="run-now"]': 'runTask'
+
+        'change input[type="search"]': 'searchChange'
+        'keyup input[type="search"]': 'searchChange'
+        'input input[type="search"]': 'searchChange'
 
     initialize: ->
         @lastTasksFilter = @options.tasksFilter

            partials:
                tasksTable: templateTable

        $search = @$el.find('input[type="search"]')
        searchWasFocused = $search.is(':focus')

        $tasksTableContainer =  @$el.find('[data-tasks-table-container]')

        if not $tasksTableContainer.length or forceFullRender


        else
            $tasksTableContainer.html templateTable context
        utils.setupSortableTables()

        @

    viewJson: (e) ->
        utils.viewJSON 'task', $(e.target).data('task-id')

    removeTask: (e) ->
        $row = $(e.target).parents('tr')
        taskModel = @collection.get($(e.target).data('task-id'))

        vex.dialog.confirm
            buttons: [
                $.extend({}, vex.dialog.buttons.YES, (text: 'Kill task', className: 'vex-dialog-button-primary vex-dialog-button-primary-remove'))
                vex.dialog.buttons.NO
            ]
            message: @killTaskTemplate(taskId: taskModel.get('id'))
            callback: (confirmed) =>
                return unless confirmed
                taskModel.destroy()
                delete app.allTasks[taskModel.get('id')] # TODO - move to model on destroy?
                @collection.remove(taskModel)
                $row.remove()

    runTask: (e) =>
        taskModel = @collection.get($(e.target).data('task-id'))
        $row = $(e.target).parents('tr')

        vex.dialog.confirm
            message: "<p>Are you sure you want to run this task immediately?</p><pre>#{ taskModel.get('id') }</pre>"
            callback: (confirmed) =>
                return unless confirmed
                taskModel.run()
                @collection.remove(taskModel)
                app.collections.tasksActive.fetch()
                $row.remove()

    searchChange: ->
        onChange = =>
            return unless @ is app.views.current
            $search = @$el.find('input[type="search"]')
            $rows = @$el.find('tbody > tr')
            lastText = ''

            searchText = _.trim $search.val()

