Remove sort icons when table is ordered

Remove sort icons when table is ordered

sbarnettsbarnett Posts: 23Questions: 5Answers: 0

If I use the following config on my table:-

$('#id_stats').dataTable({
    order: [[ 9, 'desc' ], [ 8, 'desc' ]],
    columnDefs: [
        { orderable: false, targets: [ "_all" ] },
    ]
});

I'd expect the sorting icon to not appear on any of the columns. But it doesn't seem to matter what I do, the icon is always on both the columns I've ordered on (8 and 9).

How I can order by those two columns but not allow the user to order on those columns?

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    The order icon shows based on the programmatically set order, as well as the end user order. You'd need to remove the styling of the icons in the CSS (or override them) to remove them if you don't want them at all.

    Allan

This discussion has been closed.