sDom breaks my tables
sDom breaks my tables
DavidB
Posts: 4Questions: 0Answers: 0
Hi all,
I've run into an unusual problem with a data table. It works fine, however as soon as I attempt to put an 'sDom' attribute into the datatable object I encounter an error that prevents the data table loading. This is the initialization of data tables, as I mentioned if I remove the sDom variable it works fine.
[code]
var oTable = $('#cashbackTable').dataTable({
'bProcessing': true,
'bServerSide': true,
'sAjaxSource': 'myUrl',
'fnServerData': function(sSource, aoData, fnCallback)
{
aoData.push({'name': 'csrf_token', 'value': $('input[name="csrf_token"]').val()});
aoData.push({'name': 'view', 'value': 'cashback'});
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
},
'aoColumnDefs' :
[
{'sClass' : 'c-ui-col1', 'aTargets' : [0, 2, 3, 4, 5, 6]},
{'sClass' : 'c-ui-col2', 'aTargets' : [1]},
],
'sPaginationType': 'full_numbers',
'sDom' : '<"c-ui-row"l>t'
});
[/code]
And the error I get in Firebug:
[code]
TypeError: c is undefined
...){if(a.oFeatures.bProcessing)for(var c=a.aanFeatures.r,d=0,g=c.length;d
I've run into an unusual problem with a data table. It works fine, however as soon as I attempt to put an 'sDom' attribute into the datatable object I encounter an error that prevents the data table loading. This is the initialization of data tables, as I mentioned if I remove the sDom variable it works fine.
[code]
var oTable = $('#cashbackTable').dataTable({
'bProcessing': true,
'bServerSide': true,
'sAjaxSource': 'myUrl',
'fnServerData': function(sSource, aoData, fnCallback)
{
aoData.push({'name': 'csrf_token', 'value': $('input[name="csrf_token"]').val()});
aoData.push({'name': 'view', 'value': 'cashback'});
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
},
'aoColumnDefs' :
[
{'sClass' : 'c-ui-col1', 'aTargets' : [0, 2, 3, 4, 5, 6]},
{'sClass' : 'c-ui-col2', 'aTargets' : [1]},
],
'sPaginationType': 'full_numbers',
'sDom' : '<"c-ui-row"l>t'
});
[/code]
And the error I get in Firebug:
[code]
TypeError: c is undefined
...){if(a.oFeatures.bProcessing)for(var c=a.aanFeatures.r,d=0,g=c.length;d
This discussion has been closed.
Replies
Allan
[code]
'sDom' : x
[/code]
to
[code]
"sDom" : x
[/code]
solved the problem, thanks for the code snippet!
Allan
Using jquery 1.72 and DataTables 1.9.2
Using the full source, I can trace the problem to:
Line 2896
[code]
var an = oSettings.aanFeatures.r
[/code]
an is undefined, the aanFeatures object only has t, aiDisplay and aiDisplayMaster, but no r object.
Allan
Can you add that datasource to the live.datatables.net website, so I can use it as a sAjaxSource feature?
Allan
http://live.datatables.net/emaduy/5
'sDom': 'ptr',
If the r isn't there in the sDom and bProcessing is true then you get an undefined.