DataTables V.1.10.0 .row.add() problem
DataTables V.1.10.0 .row.add() problem
koza95
Posts: 2Questions: 0Answers: 0
Hello
I tried to use new API to populate my table with TR's.
Everytime i try to use this API i get this error:
Uncaught TypeError: Cannot call method 'add' of undefined.
I have latest JQuery and DataTables version.
I initialize my table from that code:
[code]
var table = $('#table_offers');
table.dataTable({
'aoColumnDefs': [
{ 'bSortable': false, 'aTargets': [0] }
],
'sPaginationType': 'full_numbers',
'sDom': '<"dataTables_header"lfr>t<"dataTables_footer"ip>',
"aaSorting": [[ 1, "desc" ]],
'fnInitComplete': function( oSettings )
{
// Style length select
table.closest('.dataTables_wrapper').find('.dataTables_length select').addClass('select black-gradient glossy').styleSelect();
tableStyled = true;
}
});
[/code]
and then use this:
[code]
table.row.add(data).draw();
[/code]
to add data from AJAX call.
Thnaks in advace for any help.
I tried to use new API to populate my table with TR's.
Everytime i try to use this API i get this error:
Uncaught TypeError: Cannot call method 'add' of undefined.
I have latest JQuery and DataTables version.
I initialize my table from that code:
[code]
var table = $('#table_offers');
table.dataTable({
'aoColumnDefs': [
{ 'bSortable': false, 'aTargets': [0] }
],
'sPaginationType': 'full_numbers',
'sDom': '<"dataTables_header"lfr>t<"dataTables_footer"ip>',
"aaSorting": [[ 1, "desc" ]],
'fnInitComplete': function( oSettings )
{
// Style length select
table.closest('.dataTables_wrapper').find('.dataTables_length select').addClass('select black-gradient glossy').styleSelect();
tableStyled = true;
}
});
[/code]
and then use this:
[code]
table.row.add(data).draw();
[/code]
to add data from AJAX call.
Thnaks in advace for any help.
This discussion has been closed.
Replies
Use `DataTable` to get an API instance. See: http://next.datatables.net/manual/api#Accessing-the-API
Allan
Still not working :(
The same error.
Do You have any other idea how to fix this?
Allan
I recently got the same issue.
Two things made the add work :
- use of Datatable() with upcase D
- added with same type as i used to populate the table ( json / json in my case)
Marc
I am having the same issue
As I stated above, please link to a test case showing the issue so I can debug it. I posted a link to a test case which shows it working.
Allan