I am using datatable 1.9 along with tabletool.js 2.1.5. I have 23 records in total and 10 records per page. I want to select the currently displaying page records.
I have used TableTools.js buttons (select_all). But this selects all the rows of datatable. I have tried
$('#file-records> tbody > tr').each(function() {
TableTools.fnGetInstance('file-records').fnSelect($(this));
});
The above code gives me an error Uncaught TypeError: Cannot read property 'nTr' of undefined
I have implemented the following
$('#file-records> tbody > tr').each(function() {
$(this).addClass("active");
});
$(this).addClass("active"); adds a background-color: #017ebc that i have written in the css file.
so when you want to get the selected row value you can have
$('#file-records> tbody > tr').each(function() {
if($(this).hasClass('active')){
console.log($(this)[0]);
}
});
$(this)[0] is the row attribute for me, from which we can get the actual row contents