Sha256: 74f692dbccde574f23f8b591cd0a71b637cc353a2fc8ff3c0c0fb47b3164df4f

Contents?: true

Size: 1006 Bytes

Versions: 4

Compression:

Stored size: 1006 Bytes

Contents


//Global setting and initializer

$.extend( $.fn.dataTable.defaults, {
  responsive: true,
  pagingType: 'full',
  //dom:
  //  "<'row'<'col-sm-4 text-left'f><'right-action col-sm-8 text-right'<'buttons'B> <'select-info'> >>" +
  //  "<'row'<'dttb col-12 px-0'tr>>" +
  //  "<'row'<'col-sm-12 table-footer'lip>>"
});


$(document).on('preInit.dt', function(e, settings) {
  var api, table_id, url;
  api = new $.fn.dataTable.Api(settings);
  table_id = "#" + api.table().node().id;
  url = $(table_id).data('source');
  if (url) {
    return api.ajax.url(url);
  }
});


// init on turbolinks load
$(document).on('turbolinks:load', function() {
  if (!$.fn.DataTable.isDataTable("table[id^=dttb-]")) {
    $("table[id^=dttb-]").DataTable();
  }
});

// turbolinks cache fix
$(document).on('turbolinks:before-cache', function() {
  var dataTable = $($.fn.dataTable.tables(true)).DataTable();
  if (dataTable !== null) {
    dataTable.clear();
    dataTable.destroy();
    return dataTable = null;
  }
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jquery-datatables-1.10.20 lib/generators/jquery/datatables/templates/javascripts/initializer.js.tt
jquery-datatables-1.10.19.1 lib/generators/jquery/datatables/templates/javascripts/initializer.js.tt
jquery-datatables-1.10.19 lib/generators/jquery/datatables/templates/javascripts/initializer.js.tt
jquery-datatables-1.10.18 lib/generators/jquery/datatables/templates/javascripts/initializer.js.tt