Saturday, April 15, 2017

Maintain row number for specific column when other column being clicked for sorting



$(document).ready(function() {
    var t = $('#tblImamList').DataTable( {
        "columnDefs": [ {
            "searchable": false,
            "orderable": false,
            "targets": [0,1]
        } ],
        "order": []
    } );
 
    t.on( 'order.dt search.dt', function () {
     //2nd column numbering
        t.column(1, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
            cell.innerHTML = i+1;
        } );
    } ).draw();
} );

No comments:

Post a Comment