adding rows to a table

adding rows to a table

ufkufk Posts: 6Questions: 1Answers: 0

Hello.
I'm using dtatables 1.10.0, and I'm trying to add a row to a table.
i have the following code that defines the table (server side is php):

    oTable=$("#generic_drinks_table").dataTable({
            "sAjaxSource" : '<?=$this->url('drink-generic',array('action'=>'get-drinks-generic-list-json'))?>',
            "aoColumns": [
                          { "mData" : "drink_generic_id", "sTitle" : "id" },
                          { "mData" : "drink_type_name", "sTitle" : "Drink Type"},
                          { "mData" : "drink_flavor_type_name", "sTitle" : "Drink Flavor"}
                            ],
            "bProcessing": true,
            "aLengthMenu": [[100, 200, 300], [100, 200, 300]],
            "iDisplayLength": 100,
            "iDisplayStart" : 0,
            "sAjaxDataProp" : "",

    });

and I have the following code to add a row to that table:

        oTable.row.add([data, 'test', 'test']).draw();

but it seems that oTable.row is undefined! any ideas?

Answers

  • ufkufk Posts: 6Questions: 1Answers: 0

    ahhmm.. it seems that I needed to use .DataTables and not .dataTables. why ? what's the difference?

  • elkaundelkaund Posts: 1Questions: 0Answers: 0

    THANK YOUUUUUUU, I spent about an hour investigating in this. Could anyone please inform us what is the big deal?

  • galjegagaljega Posts: 4Questions: 0Answers: 0

    .DataTables is the new API in version 1.10

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Yup - second FAQ from the top.

    See also the API manual.

    Regards,
    Allan

This discussion has been closed.