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.23.0 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.22.3 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.22.2 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.22.1 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.22.0 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.21.1 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.21.0 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.20.6 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.20.5 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.20.4 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.20.3 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.20.2 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.20.1 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.20.0 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.19.1 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.19.0 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.18.0 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.17.4 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.17.3 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.17.2 app/assets/javascripts/effective_datatables/reset.js.coffee