0

I have fetched data from database in descending order and formatted in datatable it is being shown in random order it is sorting it as string

My requirements

  1. sort by 1st column descending order considering it numeric
  2. disable sorting on last column
  3. in between these 2, number of columns may vary

OR simply disable ordering data on page load, display it as it is but keep enabled columns order-able

I tried many things but could not find

Curently I am having

$('#dataTables-example').dataTable({
           'aoColumnDefs': [{
                'bSortable': false,
                'aTargets': [-1],
            }]
    });

1 Answer 1

1

the following code will disable initial sorting and disable sorting of lat column

    $('#dataTables-example').dataTable({
                "aaSorting": [],

                'aoColumnDefs': [{
                    'bSortable': false,
                    'aTargets': [-1],
                }]
    });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.