aaData using Javascript variable

aaData using Javascript variable

coolguy1coolguy1 Posts: 2Questions: 0Answers: 0
edited September 2012 in DataTables 1.8
I am trying to use Datatable to display data. I receive multiple data from a servlet. Now I need to assign the parameter "aaData" a value using javascript variable. Most of the examples I see provide value for aaData rather than use a variable. The error message I get is
DataTables warning: requested unknown parameter '0' from the data source for row 0.


The code for the data table is
jQuery(paxtable).dataTable({
bJQueryUI : true,
"bPaginate" : false,
"bFilter" : true,
"bSort" : true,
"bScrollCollapse" : true,
"sScrollY" : "200px",
"aaData" : paxrow,
"aoColumns" : [ {
"sTitle" : "Method",
"bSortable" : true
}, {
"sTitle" : "Document",
"bSortable" : true
}, {
"sTitle" : "For",
"bSortable" : true
}, {
"sTitle" : "Status",
"bSortable" : true
}, {
"sTitle" : "Message",
"bSortable" : true
}, {
"sTitle" : "Date",
"bSortable" : true
} ]
});
where
paxrow="[[\"EMAIL\",\"SOP - Guest\",\"Dr. xyz xyz\",\"SENT\",\"Email to xyz@xyz.com by nightly process\",\"2011-09-13\"],[\"EMAIL\",\"SOP - Guest\",\"Dr. xyz xyz\",\"SENT\",\"Email to xyz@xyz.com by nightly process\",\"2011-10-12\"],[\"MAIL\",\"PDOC\",\"Dr. xyz xyz\",\"SENT\",\"by nightly process\",\"2012-03-12\"]]"

Replies

  • coolguy1coolguy1 Posts: 2Questions: 0Answers: 0
    figured this out. The variable I was passing was a string. Datatables needs an array. I had to run an addtional eval function to create the array to pass to datatables
This discussion has been closed.