How to Disable RowReordering on button click

How to Disable RowReordering on button click

dparsonsdparsons Posts: 1Questions: 1Answers: 0

I have a button on my page that allows the user to click to Enable the RowReordering plugin, and another to Disable RowReordering.

Adding the plugin works fine, using the following:

function enableReordering(tableName) {           
            $("#" + tableName).dataTable(DataTableOptions).rowReordering(rowReorderingOptions);

But Removing rowReordering isn't being respected, even when I destroy the datatable and recreate it

        function disableReordering(tableName) {
            $("#" + tableName).dataTable().rowReordering().fnDestroy();
            $("#" + tableName).dataTable(DataTableOptions);

I am curious if there are any suggestions of how to get it to recreate the DataTable more assertively?

These are the options I have set in DataTableOptions:

            bPaginate: false,
            bLengthChange: false,
            bFilter: false,
            //bSort: false,
            bInfo: false,
            bAutoWidth: true,
            bDestroy: true,
            "aoColumns": [
                { sClass: "hidden" },

I know the fnDestroy() is working - if I do just that part of the disable function, it does in fact destroy the DataTable.


This discussion has been closed.