I have radio button on each row in datatable, on click of radio , table should display checked row .

I have radio button on each row in datatable, on click of radio , table should display checked row .

surabhi1211surabhi1211 Posts: 2Questions: 2Answers: 0

following is the code i have added:

$("#differentdetailsTable").on('click', "tbody tr input[name='currentRow']", function() {
$(this).closest('tr').siblings().removeClass('current-row');
$(this).closest('tr').addClass('current-row');
$("#differentdetailsTable").DataTable().row('.current-row').invalidate().draw();
newTable.columns(0).search("input[name='currentRow']:checked").draw();
$('#differentdetailsTable thead th').find(' .glyphicon-chevron-right').addClass('glyphicon-chevron-down').removeClass('glyphicon-chevron-right'); // to change the glyphyicon in the heading of the column of radio button
});

$('#differentdetailsTable').on('click',' thead tr .glyphicon-chevron-down', function(){
    var parent=$('#differentdetailsTable').find('tr td:eq(0)').find("input[name='currentRow']:checked").closest('tr');
    $('#differentdetailsTable').find('tr td:eq(0)').find("input[name='currentRow']:checked").prop('checked',false);
    newTable.row(parent).invalidate().draw();
    newTable.columns().search('').draw();
    $('#differentdetailsTable thead th').find(' .glyphicon-chevron-down').addClass('glyphicon-chevron-right').removeClass('glyphicon-chevron-down');
    });

The problem I am facing is : The first function it doesn't redraw the table neither does it search.

the second fucntion is written to clear the search

This discussion has been closed.