 
   $(document).on "change", "input[data-list-selector=all]", (event) ->
     check = $(this).is(':checked')
-    $(this).closest("table").find("td > input[data-list-selector]:not(:checked)").click() if check
-    $(this).closest("table").find("td > input[data-list-selector]:checked").click() unless check
+    $(this).closest("table").find("td > input[data-list-selector]").each ->
+      $(this).prop('checked', check).parents('tr').toggleClass('selected', check)
+      AL.select($(this), false)
+    AL.updateResults $(this).closest('*[data-list-source]')
+    AL.checkGlobalButtons $(this).closest('*[data-list-source]')
 
   # Change page of table on link clicks
   $(document).on "click", "*[data-list-ref] a[data-list-move-to-page]", (event) ->

    $(cell).data('list-cell-value')

  # Select a row of "many" buttons
  AL.select = (checkbox) ->
    list = checkbox.closest('*[data-list-source]')
    row = checkbox.closest('tr')
    selection = if list.prop('selection')? then list.prop('selection') else {}

    actions = $("*[data-list-ref='#{list_id}']")
    caption = $(list).find("tr.selected-count th")
    length = Object.keys(selection).length
    caption.text(caption.text().replace(new RegExp('(##NUM##|\\d+)'), length))
    if length > 0
      caption.parent().show()
      actions.find("*[data-list-actioner='none']:visible").hide()
