Display data to server side table dynamically.
Display data to server side table dynamically.
inquisitive_stha
Posts: 7Questions: 6Answers: 0
I have already created server-side data statically, also dynamic data is successfully fetched. But, I have no idea on displaying them.
Code
$('#voterDataTable').DataTable( {
"processing": true,
"serverSide": true,
"ajax": {
"url":base_path +'/admin/v/listVoter',
"dataType":"json",
"type":"POST",
"data":{"_token":csrf_token}
},
"columns":[
{"data":"1"},
{"data":"53"},
{"data":"74"},
{"data":"78","searchable":false,"orderable":false}
]
} );
All I need is,
{"data":"1"},
{"data":"53"},
{"data":"74"},
{"data":"78","searchable":false,"orderable":false}
this section need to looped. i.e. I want to be something like
{"data":"0"},
{"data":"1"},
{"data":"2"}
{"data":"78","searchable":false,"orderable":false}
How can I achieve this, any suggestion will be appreciated.
This discussion has been closed.
Answers
Hi @inquisitive_stha ,
Take a look at this example here - it's also retrieving objects.
Cheers,
Colin