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.8.10 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.9 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.8 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.7 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.6 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.5 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.4 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.3 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.2 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.1 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.8.0 app/assets/javascripts/effective_datatables/reset.js.coffee