Single row selecting in doesn't work.
Single row selecting in doesn't work.
Aransaja
Posts: 8Questions: 4Answers: 0
I am able to select multiple rows with the code below
$('#LineTables tbody').on('click', 'tr', function () {
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
}
else {
$(this).addClass('selected');
}
});
But everytime I'm trying to use this code below I always get this Error.
TypeError: $(...).DataTable is not a function. I put the js and css files correctly into my project. What causes this problem.
$(document).ready(function() {
var table = $('#example').DataTable();
$('#example tbody').on( 'click', 'tr', function () {
if ( $(this).hasClass('selected') ) {
$(this).removeClass('selected');
}
else {
table.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
}
} );
$('#button').click( function () {
table.row('.selected').remove().draw( false );
} );
} );
This discussion has been closed.