Sha256: 00fa070e6b700f8b71e12bebeaaa5f37329aad8e49592d57042a9e18dc6c91f6

Contents?: true

Size: 930 Bytes

Versions: 71

Compression:

Stored size: 930 Bytes

Contents

$(document).on 'click', '.dataTables_wrapper a.buttons-reset-search', (event) ->
  event.preventDefault() # prevent the click

  # Reset the HTML
  $table = $(event.currentTarget).closest('.dataTables_wrapper').find('table.dataTable').first()
  $thead = $table.children('thead').first()

  # Reset all inputs
  $thead.find('select').val('').trigger('change.select2')

  $inputs = $thead.find('input')
  $inputs.val('').removeAttr('checked').removeAttr('selected')

  # Reset delayedChange
  $.each $inputs, (input) =>
    $input = $(input)
    if ($input.delayedChange.oldVal)
      $input.delayedChange.oldVal = undefined

  # Reset the datatable
  datatable = $table.DataTable()

  # Reset search
  datatable.search('').columns().search('')

  # Reset to default visibility
  $.each $table.data('default-visibility'), (index, visible) =>
    datatable.column(index).visible(visible, false)

  # Don't pass up the click
  false

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
effective_datatables-4.11.0 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.10.7 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.10.6 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.10.5 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.10.4 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.10.3 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.10.2 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.10.1 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.10.0 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.9.4 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.9.3 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.9.2 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.9.1 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.9.0 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.16 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.15 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.14 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.13 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.12 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.11 app/assets/javascripts/effective_datatables/reset.js.coffee