Reading extra data which is passed to datatable json string

Reading extra data which is passed to datatable json string

matthewjmatthewj Posts: 39Questions: 2Answers: 0
edited August 2013 in DataTables 1.9
Hi Allan,

I am passing some extra info in datatable's json string but would you please let me know how we read that extra data. for eg I have below json string to display datatable and I am passing an extra info in the end - "completedcnt":"6"
[code]
{
"aaData":
[
{"id":1197888,"start_date":"10/12/12","due_date":"10/12/13","expire_date":"10/12/13","status":"Incomplete","overdue":false},
{"id":1198757,"start_date":"10/16/12","due_date":"10/16/13","expire_date":"10/16/13","status":"Incomplete","overdue":false}
],
"completedcnt":"6"
}
[/code]

Regards,
Mathew

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Three options here:

    1. Use fnServerData and intercept the JSON before or after you callback the DataTables draw function

    2. Use the xhr event - http://datatables.net/docs/DataTables/1.9.4/DataTable.html#xhr

    3. Use fnInitComplete which will give you the JSON as the second parameter.

    Allan
  • matthewjmatthewj Posts: 39Questions: 2Answers: 0
    Thank you very much Allan, the third option was the most suitable. Thanks once again for your great help.
This discussion has been closed.