I am adding a view/Edit Button to each row of my table , On click i have to get the data and pass it to my javascript function , but unable to do so ,
Adding the button/links like this
"columnDefs": [ {
"targets": -1,
"data": null,
"defaultContent":
'<a id="btn-view">View-</a>'
+ '<a class="btn-edit">Edit</a>'
} ]
$('#allMemberTable tbody').on('click', '.btn-edit', function (e) {
var data = table.row( $(this).parents('tr') ).data();
console.log("data ="+data[0]);
// Getting Row data scuccessfully
test(data) ; // This is not getting called , it is not recognizing this metod , giving error , test is not a function , i tried with this.test() , but same
});
// Getting Row data scuccessfully
test(data) ; // This is not getting called , it is not recognizing this metod , giving error , test is not a function , i tried with this.test() , but same
please correct me or give any other way around ( sorry for this basic question)
EDIT: Reformatted post using Markdown