Index reinitialize

by margarette

HTML

<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js"></script>
<script src="//cdn.datatables.net/plug-ins/1.10.25/sorting/datetime-moment.js"></script>
<table id='table_id' class='display'>
    <thead>
        <tr>
            <th>ID</th>
            <th>Domaine</th>
            <th>Auteur</th>
            <th>Type de média</th>
            <th>Description</th>
            <th>Date de publication</th>
            <th>Date d'ajoût</th>
            <th class='hidden'>Tags</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td class='center'><span>1</span></td>
            <td><span>🍲 Alimentation</span></td>
            <td><span>Thinkerview</span></td>
            <td><span>📀 Vidéo</span></td>
            <td><a href='https://www.youtube.com/watch?v=lXXp-PVQ0HQ' target='_blank' rel='noopener noreferrer nofollow'>L’agroalimentaire vu de l’intérieur – intoxication ?</a></td>
            <td class='center'>07/11/2019</td>
            <td class='center'>12/02/2021</td>
            <td class='hidden'><span></span></td>
        </tr>
        <tr>
            <td class='center'><span>2</span></td>
            <td><span>💶 Economie</span></td>
            <td><span>Heu?reka</span></td>
            <td><span>📹 Chaîne vidéo</span></td>
            <td><a href='https://www.youtube.com/c/HeurekaFinanceEco/featured' target='_blank' rel='noopener noreferrer nofollow'>Si vous ne comprenez rien à la finance et à l'économie</a></td>
            <td class='center'>18/10/2015</td>
            <td class='center'>12/02/2021</td>
            <td class='hidden'><span>Finance</span></td>
        </tr>
        <tr>
            <td class='center'><span>3</span></td>
            <td><span>🏫 Education</span></td>
            <td><span>Cyrille Borne</span></td>
            <td><span>🌐 Blog</span></td>
            <td><a href='https://cyrille-borne.com/'...

JavaScript

$(document).ready(function() {
    $.fn.dataTable.moment( 'DD/MM/YYYY' );

      var table = $('#table_id').DataTable({
            SearchPanes : true,
            responsive: true,
            columnDefs: [{
                targets: [1,3],
                render: function (data, type, row) {
                  if (type === 'sort') {
                    return data.replace(/.*? /,'');
                  }
                  return data;
                }
              }
            ]
      });
      });