Closed g13ydson closed 5 years ago
I solved using turbolinks:load
$(document).on('turbolinks:load', function() {
$('#users-datatable').dataTable({
"processing": true,
"serverSide": true,
"ajax": $('#users-datatable').data('source'),
"pagingType": "full_numbers",
"columns": [
{"data": "id"},
{"data": "name"},
{"data": "age"},
{"data": "show"},
{"data": "edit"},
{"data": "destroy"}
]
});
})
When accessing the index action of my user controller, the datatable is displayed correctly, but when accessing the view action, for example, and returning to the action index, the
date
method of theUserDatatable
class is not called and nothing is displayed.I noticed that the javascript file is only called the first time too.
Here are some excerpts from the code:
UserController
users.js