table.row is not a function
table.row is not a function
Hey ... this problem posted numerous times, but the resolution isn't working for me. Trying to add an onClick event to my rows. I am using server processing. When I click on the row, it throws 'Uncaught TypeError: table.row is not a function". I am using the code below on my list page:
$( document ).ready(function() {
$('#contactlisting').DataTable({
"bProcessing": false,
"bPaginate": true,
"sPaginationType": "full_numbers",
"sAjaxSource": "includes/jq_contacts.php",
"bDeferRender": true,
"bStateSave": true,
"aoColumns": [
{ mData: 'displayname' } ,
{ mData: 'company' },
{ mData: 'primarycity' },
{ mData: 'primarystate' },
{ mData: 'primaryphone' },
{ mData: 'primaryemail' },
{ mData: 'company_id' },
]
});
var table = $('#contactlisting').DataTable();
$('#contactlisting tbody').on('click', 'tr', function () {
alert(table.row(this).data());
});
});
The prevailing fix has been to use .DataTable() as opposed to dataTable(), but that has not resolved my issue. Any thoughts on this would be tremendously appreciated, as I was hoping on launching this solution on Monday! Thanks so much.
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Answers
We'd need a link to a test case showing the issue - per the forum rules. What you have above looks correct as long as you are using 1.10+.
Allan