<commit_before>initializeDataTables = ->
  $('table[data-effective-datatables-table]').each ->
    return if $.fn.DataTable.fnIsDataTable(this)

    datatable = $(this)

    init_options =
      ajax: { url: datatable.data('source'), type: 'POST' }
      autoWidth: false
      buttons: [
        {
          extend: 'colvis',
          text: 'Show / hide columns',
          postfixButtons: [
            { extend: 'colvisGroup', text: 'Show all', show: ':hidden'},
            { extend: 'colvisRestore', text: 'Show default'}
          ]
        }, 'copy', 'csv', 'excel', 'print'
      ]
      colReorder: true
      columns: datatable.data('columns')
      deferLoading: [datatable.data('display-records'), datatable.data('total-records')]
      deferRender: true
      iDisplayLength: datatable.data('display-entries')
      language: { 'lengthMenu': 'Show _MENU_ per page'}<commit_msg>better way of exporting csv header<commit_after>initializeDataTables = ->
  $('table[data-effective-datatables-table]').each ->
    return if $.fn.DataTable.fnIsDataTable(this)

    datatable = $(this)

    init_options =
      ajax: { url: datatable.data('source'), type: 'POST' }
      autoWidth: false
      buttons: [
        {
          extend: 'colvis',
          text: 'Show / hide columns',
          postfixButtons: [
            { extend: 'colvisGroup', text: 'Show all', show: ':hidden'},
            { extend: 'colvisRestore', text: 'Show default'}
          ]
        },
        'copy',
        {
          extend: 'csv',
          exportOptions:
            format:
              header: (d) ->
                console.log d
                d
        },
        'excel',
        'print'
      ]
      colReorder: true
      columns: datatable.data('columns')
      deferLoading: [datatable.data('display-records'), datatable.data('total-records')]
      deferRender: true
      iDisplayLength: datatable.data('display-entries')
      language: { 'lengthMenu': 'Show _MENU_ per page'}
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0, 'mean_word_length': 2.1621621621621623, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6961515', 'n_tokens_mistral': 595, 'n_tokens_neox': 578, 'n_words': 124}