Fixed table Row select inverses the '.selected' value
Fixed table Row select inverses the '.selected' value
narendran.kandan
Posts: 4Questions: 2Answers: 0
My requirement is select a row and delete it by clicking on DELETE button. My table has first 4 columns as fixed. When i click on any cells on the fixed column the row gets selected but the " $(this).toggleClass('selected'); " value is set to 0 instead of 1. The fixed cells alone returns inverse value for row select. Please find my sample code
$('#example tbody').on( 'click', 'tr', function () {
var _table = $('#example').DataTable();
var _delbtn = _table.button(6);
$(this).toggleClass('selected');
if ( _table.rows('.selected').data().length === 0 ) {
_delbtn.disable();
}
else {
_delbtn.enable();
}
} );
I tried setting select property to true for fixed columns but nothing changed.
"fixedColumns" : {
"leftColumns" : 4,
"select": true
}
Please help me out on this.
This discussion has been closed.
Answers
Hi @narendran.kandan ,
The problem is likely because FixedColumns creates an overlay to get the desired effect. I would recommend using the Select extension, since this is all catered for - see here.
Cheers,
Colin