     }
     filterCheckboxes(this, criteria)
 
-  $('#js-events-past-checkbox').click ->
+  $('#js-events-past-checkbox').change ->
     $("#js-events-current-checkbox").prop('checked', false)
     criteria = {
       type: "past",

                  { orderData: 4, targets: 5 },
                  { visible: false, targets: [2,4,8] }
                ]

  $('div.eventToolbar').html('<label>Current:<input type="checkbox" id="js-events-current-checkbox" name="event-filter"></label>
  <label>Past:<input type="checkbox" id="js-events-past-checkbox" name="event-filter"></label>
  <label>Templates:<input type="checkbox" id="js-events-template-checkbox" name="event-filter"></label>')

  filterCheckboxes = (element, criteria) ->
    $.fn.dataTable.ext.search.push((settings, data, dataIndex) ->
      checkboxState = element.checked
      itemStatus  = data[7]
      endTime = new Date(data[5])
      isTemplate = data[8]

      if criteria.type is "current"
        if (checkboxState is false) or (checkboxState is true and
            endTime > criteria.dateTime)
          return true
        return false
      else if criteria.type is "past"
        if (checkboxState is false) or (checkboxState is true and
            endTime < criteria.dateTime)
          return true
        return false
      else if criteria.type is "template"
        if (checkboxState is false) or (checkboxState is true and
            isTemplate is "True")
          return true
        return false
      )
    table.fnDraw()

  $('#js-events-current-checkbox').click ->
    $("#js-events-past-checkbox").prop('checked', false)
    criteria = {
      type: "current",

    }
    filterCheckboxes(this, criteria)

  $('#js-events-template-checkbox').change ->
    criteria = {
      type: "template",
    }
    filterCheckboxes(this, criteria)

