Button Click Event - Uncaught TypeError: undefined is not a function

Button Click Event - Uncaught TypeError: undefined is not a function

andrekarnerandrekarner Posts: 5Questions: 2Answers: 1

hi, its me again - sorry!

i've got a table with an action column (2 buttons).

i attached those buttons an event - copied from example database:

$('#deletedBanners tbody').on('click', 'button', function () {
var data = $("#deletedBanners").dataTable.row($(this).parents('tr')).data();
alert(data[0] + "'s salary is: " + data[5]);
});

when i click on one of these buttons, the debug console tells me: "Uncaught TypeError: undefined is not a function"
"$("#deletedBanners").dataTable" returns data
"$(this).parents('tr')" returns also data
but $("#deletedBanners").dataTable.row($(this).parents('tr')) & $("#deletedBanners").dataTable.row($(this).parents('tr')).data()
do not return data!

my col definition for those buttons:
{
"targets": -1,
"data": null,
"defaultContent": '<button id="bannerRestoreActionRestore" class="btn btn-success btn-circle" data-toggle="tooltip" data-placement="top" title="Banner wiederherstellen"><i class="fa fa-recycle"></i></button><button id="bannerRestoreActionDelete" class="btn btn-danger btn-circle pull-right" data-toggle="tooltip" data-placement="top" title="Banner entgültig entfernen"><i class="fa fa-close"></i></button>'
}

so my question is: where is the problem?

thanks,

andre!

Answers

  • andrekarnerandrekarner Posts: 5Questions: 2Answers: 1

    problem solved!

    table initialization: dataTable instead of DataTable

This discussion has been closed.