mongodb bson to datatable
mongodb bson to datatable
This is my source JSON. This is exactly how it comes off the wire in the HTTP response body from my ajax call. It is an array of objects.
[{"Id":"53a7aa87aba021285cc8ca0b","Counter":1,"IPAddress":"10.0.0.1","Protocol":"tcp","Port":"7","FirstSeen":"2014-06-22T00:00:00Z","LastSeen":"2014-06-22T00:00:00Z"},{"Id":"53a7aa87aba021285cc8ca0c","Counter":2,"IPAddress":"10.0.0.1","Protocol":"tcp","Port":"21","FirstSeen":"2014-06-22T00:00:00Z","LastSeen":"2014-06-22T00:00:00Z"}]
I can't for the life of me figure out how to present it in dataTables using 1.10.2 jquery and 1.10.0 jqueryDatables.
My most recent attempt looks something like this, but I've tried many different iterations.
$('#exampletwo').dataTable({
"ajax": "/api/openports/may-srx-home/",
"type": "GET",
"columnDefs": [{
//"targets": 0,
"data": null, // Use the full data source object for the renderer's source
"render": {
"_": "Counter",
"filter": "IPAddress",
"display": "IPAddress"
}
}]
Help?
Answers
I finally figured this out using DataTable not dataTable. Code below