render js object

render js object

andrew1986andrew1986 Posts: 12Questions: 5Answers: 0

I'm trying to render a table with data from a object, however, I haven't found a way to make right, I would like to know what am I doing wrong?;

Basically, I parse some json data as "response" and on of the object key is users, which values I need to display on the table:

users: [{id: "0", name: "the_name", status: "status"]}
It has several values according to the json response, so I isolate it like this.

var data = response["users"];
When I console.log it, it display an object with a few arrays which contains all users information as it supposes to do.

Then I try to render the data table like here using of course the Object sample:

$("#myTable").dataTable({
data: data,
columns: [
{ data: 'id' },
{ data: 'name' },
{ data: 'status' }
]
});

And my html table looks like this:

ID Name Status

For some reason, I'm getting No data available in table all the time.

Any guessing???

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    Answer ✓

    That looks like it should be quite possible. Can you please link to a test case showing the issue, or use the DataTables debugger to give us some information ( http://debug.datatables.net ).

    Allan

This discussion has been closed.