Angular 2 DataTables pagination
Angular 2 DataTables pagination
scobee
Posts: 1Questions: 1Answers: 0
Hello,
I am trying to implement a simple pagination on my dataTable
The table is initialized like this:
let userList: any = $('#userList');
this.datatable = userList.DataTable({
'ajax': {
'url': "/api/user/all",
'type': "GET",
headers: {
'Authorization': apiRequest.token
},
},
"iDisplayLength": 10,
"bPaginate": true,
dom: '<"html5buttons"B>lTfgitp',
responsive: {
details: {
display: $.fn.dataTable.Responsive.display.childRowImmediate,
type: ''
}
}
});
I don't want to add column definitions here, since I want to process everything in the html (I have a ngFor that passes trough the response and fills the columns with data)
I've tried with a ton of responses but none of them seem to work:
{"draw":1,"recordsTotal":10,"recordsFiltered":1,"data":[{"userID":2,"userFirstName":"tester","userLastName":"tester 2","userStatus":"premium","userEmail":"bla@bla.com","isConnected":null,"isOnDiscord":false,"userRole":3,"userDiscordUID":null,"userDiscordUsername":null,"userStartDate":"2017-11-07T15:17:17.000Z","userExpiration":"2018-04-25T00:00:00.000Z","userBlacklistReason":"","isReseller":false,"ips":[],"orders":[]}]}
Can you guys give me a quick info on how to implement this ?
Thank you
This discussion has been closed.