Disabling sorting on a column is not working

Disabling sorting on a column is not working

chadhortonchadhorton Posts: 1Questions: 1Answers: 0

I'm trying to disable sorting on a specific column and it isn't working.

I have a table where the very first column is an options table and I don't want it sortable. I've tried the columnDefs and columns options but neither are working.

        var oTable = $('#datatable_fixed_column').dataTable({
            "columnDefs": [ {
                "targets": 0,
                "orderable": false
            } ],
            "sDom" : "<'dt-top-row'><'dt-wrapper't><'dt-row dt-bottom-row'<'row'<'col-sm-6'i><'col-sm-6 text-right'p>>",
            //"sDom" : "t<'row dt-wrapper'<'col-sm-6'i><'dt-row dt-bottom-row'<'row'<'col-sm-6'i><'col-sm-6 text-right'>>",
            "oLanguage" : {
                "sSearch" : "Search all columns:"
            },
            "bSortCellsTop" : true
        });

Answers

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

    That should work, but keep in mind that the default ordering is on the first column, and as the columns.orderable documentation states, it effects only the user's ability to set the ordering of the column - not the API. So the default ordering is still being applied. Use order to change the default.

    Allan

This discussion has been closed.