jQuery datatables aaData not accepting array of Strings and works only with Object?

jQuery datatables aaData not accepting array of Strings and works only with Object?

E2241E2241 Posts: 2Questions: 1Answers: 0
edited January 2015 in Free community support

I have tried to build a datatable using the datatables plugin.

Following are screen shots of the response I am getting using ajax in Firefox. For some reason I am not able to bind the data with the datatable in second scenario. The JSON object seems to be loading fine.

I have seen that in the first case I am sending back a list of Objects to the aaData variable for datatables and this works with the datatable. However in the second case where its not working, I am sending back the data in the form of string arrays in the json response for aaData. I cant send a list of java objects as I am not sure how many columns the table will have. It can have dynamic number of columns.

I have added the screen shots on this link: http://stackoverflow.com/questions/27867139/jquery-datatables-aadata-not-accepting-array-of-strings-and-works-only-with-obje

Answers

  • E2241E2241 Posts: 2Questions: 1Answers: 0

    I solved it by parsing the data using:

    var json = JSON.parse(data);
    
This discussion has been closed.