How to add preloading to DataTables
2022-02-19 Games 6322022-02-20 Games
1. Css
#example1 { display:none; }
2. Html
<div id="show-loading" class="text-center">3. JavaScript
<i class="fas fa-2x fa-sync-alt fa-spin"></i><span> Loading...</span>
</div>
<table id="example1"> ... ... ... </table>
$("#example1").DataTable({
"responsive" : true,
"autoWidth" : false,
"initComplete": () => {
$("#example1").show();
let loading = document.getElementById("show-loading");
loading.style.display = "none";
}
});
Ref Idea
preloading | Web Development