Javascript sourced datatabe
Javascript sourced datatabe
nullpointer
Posts: 23Questions: 12Answers: 2
Hi, I am creating a datatable with Javascript sourced data, as the example http://www.datatables.net/examples/data_sources/js_array.html
But I can't see the data, and I would say that the code is OK:
var dataSet = [
['Trident','Internet Explorer 4.0','Win 95+','4','X'],
['Other browsers','All others','-','-','U']
];
$(document).ready(function() {
var oTable;
oTable = $('#applicationsDatatable').dataTable( {
"data": dataSet,
"sScrollY": "auto",
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bPaginate": true,
"bLengthChange": true,
"bFilter": true,
"aaSorting": [[ 0, "asc" ]],
"aoColumns": [
{ "bSortable": false },
null,null,null,null,null
],
"bSort": true,
"bInfo": true,
"bAutoWidth": true,
"bSortCellsTop": true,
"sDom": 'tlpi<"clear">'
});
} );
<div id="content4menu2" class="contentcontainer" style="margin-left:0;width:auto;border-top:1px solid #30699C;">
<table cellpadding="0" cellspacing="0" border="0" class="display normaltable" id="applicationsDatatable" />
</div>
debug code: efibum
Thanks
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Your data arrays have 5 elements, but your
aoColumns
defines 6 columns. Is that intentional? That would be my guess as to what is causing the error.Allan
It was a copy error, I generated again the page with 5 columns defined
debug code: ibehav
Can you update to the latest release please. 1.10.3.
Allan
Dear Allan,
I just updated to 1.10.3., but it seems that the problem remains
debug code: ofifef
The debugger suggests there are no tables, which probably means that there was a JS error while initialising the table. What does the browser's console show?
Allan
Indeed, it was a javascript error. Thanks