Selecting Rows so I can allow users to edit data - Uncaught TypeError: undefined is not a function
Selecting Rows so I can allow users to edit data - Uncaught TypeError: undefined is not a function
I tried following the table.row(this).data selection but it does not work - gives me the "Uncaught TypeError: undefined is not a function "
I am using the latest ver of jquery 2.x.x - here are my refs:
<link rel="stylesheet" type="text/css" href="css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="css/dataTables.scroller.min.css">
<script src="libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" language="javascript" src="libs/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="libs/dataTables.scroller.min.js"></script>
I put the code for the row click after the datatable definition - same error
Put it in the InitComplete anonymous function - same error
Tried doing the same with cell selection - same error
I am only loading 50 rows in the grid to test with
Any help would be excellent
here is my grid loading code in the <head> tag:
<script type="text/javascript" language="javascript" class="init">
$(document).ready(function() {
var tbl = $('#grid').dataTable( {
"ajax": "/properties",
"deferRender": true,
"bSortClasses": false,
"processing": true,
"dom": 'lftipr',
"lengthMenu": [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ],
"pagingType": "full_numbers",
"initComplete": function(settings, json) {
console.log( 'DataTables has finished its initialisation.' );
$('#grid tbody').on( 'click', 'tr', function () {
console.log( tbl.row( this ).data() );
} );
},
"columns": [
{ data: "id" },
{ data: "name" },
{ data: "address" },
{ data: "address2" },
{ data: "city" },
{ data: "state" },
{ data: "zip" },
{ data: "contact" },
{ data: "contact2" },
{ data: "email" },
{ data: "email2" },
{ data: "phone" },
{ data: "phone2" },
{ data: "fax" },
{ data: "fax2" },
{ data: "mobile" },
{ data: "mobile2" }
]
} );
//$('#grid tbody').on( 'click', 'tr', function () {
// console.log( tbl.row( this ).data() );
//} );
} );
</script>
Replies
Check your web server error log for syntax errors. Also check your javascript developer console output. On Chrome, this is Ctrl-Shift-j
You are using the old API. See the second top FAQ.
Allan
@johnuga - checked those - use chrome dev tools every day - no syntax error that I was aware of
@allan - ok, I will check that api version - I just went with the docs that I found online - will check the FAQ - thanks!
Changed to DataTable instead of dataTable - worked perfect! Excellent and thanks for the support - it's appreciated. If I can get the $ from my project I will buy some support creds