Requested unknown parameter '0' from the data source for row '0'
Requested unknown parameter '0' from the data source for row '0'
Does anybody please know, what is wrong with the very simple HTML file below?
The screenshot can be seen at
http://stackoverflow.com/questions/16539578/datatables-warning-requested-unknown-parameter-0-from-the-data-source-for-row
I am just trying to use an array of objects as the data source for DataTables:
[code]
var data = [
{"Name":"UpdateBootProfile","Result":"PASS","ExecutionTime":"00:00:00","Measurement":[]},
{"Name":"NRB Boot","Result":"PASS","ExecutionTime":"00:00:50.5000000","Measurement":[{"TestName":"TOTAL_TURN_ON_TIME","Result":"PASS","Value":"50.5","LowerLimit":"NaN","UpperLimit":"NaN","ComparisonType":"nctLOG","Units":"SECONDS"}]},
{"Name":"NvMgrCommit","Result":"PASS","ExecutionTime":"00:00:00","Measurement":[]},
{"Name":"SyncNvToEFS","Result":"PASS","ExecutionTime":"00:00:01.2500000","Measurement":[]}
];
$(function() {
var testsTable = $('#tests').dataTable({
bJQueryUI: true,
aaData: data,
aoColumns: [
{ mData: 'Name' },
{ mData: 'Result' },
{ mData: 'ExecutionTime' }
]
});
});
Name
Result
ExecutionTime
[/code]
The screenshot can be seen at
http://stackoverflow.com/questions/16539578/datatables-warning-requested-unknown-parameter-0-from-the-data-source-for-row
I am just trying to use an array of objects as the data source for DataTables:
[code]
var data = [
{"Name":"UpdateBootProfile","Result":"PASS","ExecutionTime":"00:00:00","Measurement":[]},
{"Name":"NRB Boot","Result":"PASS","ExecutionTime":"00:00:50.5000000","Measurement":[{"TestName":"TOTAL_TURN_ON_TIME","Result":"PASS","Value":"50.5","LowerLimit":"NaN","UpperLimit":"NaN","ComparisonType":"nctLOG","Units":"SECONDS"}]},
{"Name":"NvMgrCommit","Result":"PASS","ExecutionTime":"00:00:00","Measurement":[]},
{"Name":"SyncNvToEFS","Result":"PASS","ExecutionTime":"00:00:01.2500000","Measurement":[]}
];
$(function() {
var testsTable = $('#tests').dataTable({
bJQueryUI: true,
aaData: data,
aoColumns: [
{ mData: 'Name' },
{ mData: 'Result' },
{ mData: 'ExecutionTime' }
]
});
});
Name
Result
ExecutionTime
[/code]
This discussion has been closed.
Replies
http://live.datatables.net/ugizod/edit#javascript,html
Allan
http://live.datatables.net/ocavik/edit#source
But get a new error message:
[quote]
DataTables warning (table id = 'tests'):
Requested unknown parameter {mData function} from the data source for row 0
[/quote]
Any suggestions please? Below is my new code:
[code]
var data = <?= json_encode($data) ?>;
function renderResult(data, type, val) {
if (type === 'set') {
if (val === 'PASS') {
data.display = '' + val + '';
} else if (val === 'FAIL') {
data.display = '' + val + '';
} else {
data.display = val;
}
data.result = val;
return;
}
if (type === 'display') {
return data.display;
}
// for type = sort, type, filter and undefined
return data.result;
}
$(function() {
var testsTable = $('#tests').dataTable({
bJQueryUI: true,
aaData: data,
aoColumns: [
{ mData: 'Name' },
{ mData: renderResult },
{ mData: 'ExecutionTime' }
]
});
});
[/code]
http://live.datatables.net/ocavik/5/
Regards
Alex