Reputation: 914
I have the following JSON:
{"contents":
[
{"mossadId":2,"empId":"999666333","id":12},
{"mossadId":4,"empId":"999666333","id":13},
{"mossadId":2,"empId":"301301301","id":14}
]
}
I have verified this by writing this result to the console.
I am then using the following code to try make a table out of it:
var response = (data.contents); // remove containing 'contents' envelope
console.log(response);
var table12 = new Tabulator("#mossadListing", {
layout:"fitColumns",
data: response,
columns:[
{title:"organization", field:"mossaId", sorter:"string", width:100,
]
});
But i land us with a table with one columns, which all fields are empty.
Am I doing something wrong?
Upvotes: 0
Views: 39
Reputation: 19655
If you are going to specify columns then the field
name has to match the object key. Your data has:
"mossadId"
and the field is named:
"mossaId"
note the missing 'd'.
You also have only one field/column defined. If you want to see the rest you need to add them to columns
.
Upvotes: 1