Remove sorting for specific column of the dataTable

Remove sorting for specific column of the dataTable

Afroz AliAfroz Ali Posts: 5Questions: 3Answers: 0

Hi,

I want to know how to remove sorting option(functionality) for specific column of the dataTable. For example, In my case i want to remove sorting option for last two column of the dataTable. Thanks in advance.

Thanks & Regards,
Ali

Answers

  • rf1234rf1234 Posts: 2,982Questions: 87Answers: 421

    You can also use this with classes assigned to your columns making your code easier to maintain if you add columns later on.

    HTML

    <table id="tblCashFlow" class="table table-striped table-bordered"
               cellspacing="0" width="100%">
            <thead>            
                <tr>
                    <th>Element</th>
                    <th class="noSort"><?php echo $en?('Payment Date'):('Zahlungsdatum');?></th>
                    <th class="hiddenCols"><?php echo $en?('Interest Date'):('Zins-Sichtag');?></th>
                </tr>
            </thead>
        </table>     
    

    Javascript

    columnDefs: [
     { targets: "noSort", orderable: false },
     { targets: "hiddenCols", visible: false},
    
This discussion has been closed.