TypeError: nThs[(i - iCorrector)] when using aoColumnDefs
TypeError: nThs[(i - iCorrector)] when using aoColumnDefs
Hello All,
I am getting " TypeError: nThs[(i - iCorrector)] when using aoColumnDefs" , and not understanding what is wrong with my code below which is causing this error...
My table initialization
[code]
$(document).ready(function() {
$('#targetsTable').dataTable({
"sDom":'<"H"Cfr>t<"F"ip>',
"bjQueryUI":true,
"aoColumnDefs":[
{"aTargets" : [1], "sWidth": "auto", "sTitle":"Name"},
{"aTargets" : [2], "sWidth": "auto", "sTitle":"Target Type"},
{"aTargets" : [7], "sWidth": "auto", "sTitle":"Status"},
{"aTargets" : [8], "sWidth": "auto", "sTitle":"Is Viral"},
{"aTargets" : [4], "sWidth": "auto", "sTitle":"Created Date"},
{"aTargets" : [6], "sWidth": "auto", "sTitle":"EntrezGene ID"}
],
"bProcessing": true,
"bServerSide":true,
"sAjaxSource": "<%= request.getContextPath() +"/rest/targets/jquerytargets"%>"
});
} );
[/code]
My HTML
[code]
Targets
Name
Target Type
Status
Is Viral
Created Date
EntrezGene ID
[/code]
Following is the data returned from my server side script
[quote]
{"iTotalRecords":1,"iTotalDisplayRecords":1,"sEcho":"Hello","aaData":[{"id":"E4646C5EC3CB4608E0400C0A0633054A","name":"Target 1","targetType":"Cell membrane glycoprotein","creator":"mamidrx","createdDate":"Aug 20, 2013 11:19:37 AM","contacts":[],"entrezgeneID":0,"status":"Pending","isViral":false}]}
[/quote]
Any help as to what I am doing wrong...
Thanks in advance
I am getting " TypeError: nThs[(i - iCorrector)] when using aoColumnDefs" , and not understanding what is wrong with my code below which is causing this error...
My table initialization
[code]
$(document).ready(function() {
$('#targetsTable').dataTable({
"sDom":'<"H"Cfr>t<"F"ip>',
"bjQueryUI":true,
"aoColumnDefs":[
{"aTargets" : [1], "sWidth": "auto", "sTitle":"Name"},
{"aTargets" : [2], "sWidth": "auto", "sTitle":"Target Type"},
{"aTargets" : [7], "sWidth": "auto", "sTitle":"Status"},
{"aTargets" : [8], "sWidth": "auto", "sTitle":"Is Viral"},
{"aTargets" : [4], "sWidth": "auto", "sTitle":"Created Date"},
{"aTargets" : [6], "sWidth": "auto", "sTitle":"EntrezGene ID"}
],
"bProcessing": true,
"bServerSide":true,
"sAjaxSource": "<%= request.getContextPath() +"/rest/targets/jquerytargets"%>"
});
} );
[/code]
My HTML
[code]
Targets
Name
Target Type
Status
Is Viral
Created Date
EntrezGene ID
[/code]
Following is the data returned from my server side script
[quote]
{"iTotalRecords":1,"iTotalDisplayRecords":1,"sEcho":"Hello","aaData":[{"id":"E4646C5EC3CB4608E0400C0A0633054A","name":"Target 1","targetType":"Cell membrane glycoprotein","creator":"mamidrx","createdDate":"Aug 20, 2013 11:19:37 AM","contacts":[],"entrezgeneID":0,"status":"Pending","isViral":false}]}
[/quote]
Any help as to what I am doing wrong...
Thanks in advance
This discussion has been closed.
Replies
Allan
Thanks allan for the clarification.. So Even if I do not want to display all the fields that is coming from my json object, I need to specify all of them column headers.. and then hide the ones that I do not need using CSS ?
btw: Datatables are awesome !!!!
Thanks,
Ravi
And yes, that's correct. Use the bVisible option to hide the column. Or if you don't want it to be visible in the table ever, just don't specify it in your columns definition.
Allan