DataTables warning (table id ='example'):Requested unknown parameter '0' from the data source row0
DataTables warning (table id ='example'):Requested unknown parameter '0' from the data source row0
<!DOCTYPE html>
$(document).ready(function (){
$("#example").dataTable({
"sAjaxSource":"emp.json",
"display":"envelope",
// "aoColumns":[null,null,
// {
// "mData":null,
// "sDefaultContent":"Edit"
// }],
"aoColumnDefs":[{
"mDataProp":null,
"sTitle":"Edit",
"aTargets":[-1]
}],
//
"aLengthMenu": [[5, 10, 15, 20, -1], [5, 10, 15, 20, "All"]], //define pagination dropdown
"iDisplayLength": 10, //define initial size of the pagination
"bJQueryUI": true,
"sPaginationType": "full_numbers"
});
});
FullName
Address:
//emp.json
{
"aaData":[
{"name":"aarati","address":"chabhil"},
{"name":"bebina","address":"maharajgunj"}
]
}
I cannot get the matter here with aoColumnDef and aoColumns..
If I use aoColumns the table appears to be right but not being able to extract data from json file.
with aoColumnDef though the data is not extracted from Json but the address (td) is removed instead Edit is seen there and the above mentioned problem appears... I am totally confused and lost my huge time.
$(document).ready(function (){
$("#example").dataTable({
"sAjaxSource":"emp.json",
"display":"envelope",
// "aoColumns":[null,null,
// {
// "mData":null,
// "sDefaultContent":"Edit"
// }],
"aoColumnDefs":[{
"mDataProp":null,
"sTitle":"Edit",
"aTargets":[-1]
}],
//
"aLengthMenu": [[5, 10, 15, 20, -1], [5, 10, 15, 20, "All"]], //define pagination dropdown
"iDisplayLength": 10, //define initial size of the pagination
"bJQueryUI": true,
"sPaginationType": "full_numbers"
});
});
FullName
Address:
//emp.json
{
"aaData":[
{"name":"aarati","address":"chabhil"},
{"name":"bebina","address":"maharajgunj"}
]
}
I cannot get the matter here with aoColumnDef and aoColumns..
If I use aoColumns the table appears to be right but not being able to extract data from json file.
with aoColumnDef though the data is not extracted from Json but the address (td) is removed instead Edit is seen there and the above mentioned problem appears... I am totally confused and lost my huge time.
This discussion has been closed.
Replies