I'm using jQuery DataTables in two of my Rails 6 applications. In one application it works fine, in the other application I can't get it to work. I always get the following error:
Uncaught TypeError: Cannot set property '_DT_CellIndex' of undefined
In my other application this error occured when the number of header columns doesnt match the actual table columns, but those are appropriate in the actual case (2 header columns, 2 table columns).
Here's the table code:
<table id="general_feeds" class="table table-borderless text-center">
<thead class="bg-bdh text-white shadow">
<tr>
<th>Datum</th>
<th>Rolle</th>
</tr>
</thead>
<tbody>
<% @feedbacks.each do |feedback| %>
<tr>
<td><%= I18n.l(feedback.date) %></td>
<td><%= feedback.role_before_type_cast %></td>
<tr>
<% end %>
</tbody>
</table>
And here is my js-code to initialize the table:
$("#general_feeds").DataTable({
"language": {
"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json"
},
responsive: true,
searching: true
});
I read all the threads in the datatables forum but couldn't get it to work. I know that the plugin doesnn't support colspan etc. which I'm not using.
Any suggestions?