Sha256: 059b197eb289f160990a2cbcc0d093d90030a00ec289d54046ca4f887e55a1b1

Contents?: true

Size: 771 Bytes

Versions: 11

Compression:

Stored size: 771 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 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

11 entries across 11 versions & 1 rubygems

Version Path
effective_datatables-4.30.1 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.30.0 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.29.0 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.26.0 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.25.3 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.25.2 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.25.1 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.25.0 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.24.2 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.24.1 app/assets/javascripts/effective_datatables/reset.js.coffee
effective_datatables-4.24.0 app/assets/javascripts/effective_datatables/reset.js.coffee