jquery - dataTables removes row after click -
i want call function after clicking on datatables row. row disappears after clicking error "datatables warning: table id=datatables-example-requested unknown parameter '0' row 0, column0. more information error, please see http://datatables.net/tn/4"
i found code in 1 of posts:
$(document).ready(function() { var table = $('#datatables-example').datatable(); $('#datatables-example tbody').on( 'click', 'tr', function () { var id = table.row().data(1); myfunction(id); return false; }); });
if put in id hardcoded works fine, somehow table.row().data(1) generates error.
data()
returns either array or object, , takes params if update values. why error, data()
expects array or object when used setter-method. need specify want data()
clicked row, row()
return first visible row on page. use
var id = table.row(this).data()[1];
instead.
Comments
Post a Comment