DataTables V.1.10.0 .row.add() problem

DataTables V.1.10.0 .row.add() problem

koza95koza95 Posts: 2Questions: 0Answers: 0
edited February 2014 in DataTables 1.10
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.

Replies

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    > table.dataTable({

    Use `DataTable` to get an API instance. See: http://next.datatables.net/manual/api#Accessing-the-API

    Allan
  • koza95koza95 Posts: 2Questions: 0Answers: 0
    Hello
    Still not working :(
    The same error.
    Do You have any other idea how to fix this?
  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    Works okay for me here: http://live.datatables.net/tamateb/1/edit . So I would need a test case showing the error to be able to debug.

    Allan
  • mlavalmlaval Posts: 1Questions: 0Answers: 0

    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

  • gastoncsgastoncs Posts: 8Questions: 1Answers: 0

    I am having the same issue

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    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

This discussion has been closed.