JQuery DataTable with Ajax, post API Call Hook
$(async function() {
$('#registry_table').DataTable({
serverSide: true,
ajax: {
url: 'localhost:3000/provenance/registries',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + localStorage.getItem("token")
},
data: () => {
return {page: 0, per_page: 5};
}
},
columns: [
{data: 'name', defaultContent: 'N/A'},
{data: 'created', defaultContent: 'N/A'},
{data: 'extrinsic', defaultContent: 'N/A'},
{data: 'registry', defaultContent: ' <span class="text-primary bg-white fa-border d-inline-block" style="cursor: pointer" title="Rename Registry"><i class="fas fa-pen-nib"/> Rename</span>'}
],
language: {
searchPlaceholder: "Search...",
search: "",
lengthMenu: "_MENU_ items/page"
}
});
});
Code with bulbul