Accessing data in JSON format after DataTable initilization

Accessing data in JSON format after DataTable initilization

sumitshiningsumitshining Posts: 12Questions: 0Answers: 0
edited January 2013 in General
Hi,

I have a datatable already initialized. I can't make changes in existing code. Instead, I have to write code to access the data that is received in JSON.

I can see some data in response to the http request in JSON but can't deduce a method to retrieve it. It can be retrieved using fnGetData(i) where i is the row index but this is not json format data.

My actual requirement is to use a property value received in the data from server. So from the server I am sending it as an object embedded in the data. Any other way it can be retrieved?

Replies

  • allanallan Posts: 63,195Questions: 1Answers: 10,412 Site admin
    Perhaps fnInitComplete ? The second parameter passed into that is the json data from the server.

    Allan
  • sumitshiningsumitshining Posts: 12Questions: 0Answers: 0
    Yeah. This works but the problem is extended to the function called.
    Now, since the data is in array form even if I pass the data as object it goes into an array and ultimately I end up at same problem. Probably the solution you provided to opt for Object rather than array might help.
  • allanallan Posts: 63,195Questions: 1Answers: 10,412 Site admin
    I don't really understand I'm afraid. fnInitComplete passes the json object from the server straight through.

    Please link to a test case: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read

    Allan
This discussion has been closed.