why data does not sort ?

why data does not sort ?

Dylan33Dylan33 Posts: 2Questions: 1Answers: 0

Hi, I am beginner.
I am testing basic initialisation for Zero configuration. Display of data of mysql, search, paging are ok. But sort data does not work. It displays up and down arrow images. The data of column does not sort. What I have missed?Below is what I used:

    <link rel="stylesheet" href="//cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css"/>
     <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
      <script src="//cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js"></script>

   ...
    $(document).ready(function () {
            $('#users').DataTable({
                "columns": [
                    {"data": "id"},
                    {"data": "name"},
                    {"data": "phone"},
                    {"data": "email"},
                    {"data": "country"},
                    {"data": "zip"}
                ],
                "processing": true,
                "serverSide": true,
                "ajax": {
                    url: 'demo.php',
                    type: 'POST'
                }
            });

This is screen:

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,158Questions: 1Answers: 2,587
    Answer ✓

    You've enable serverSide, so it's upto the server-side script to sort the data. If you have less that 10-15k records, it's unlikely that you need that enabled.

    If you do, the protocol is discussed here. Also see examples here. If you download the DataTables repo, there are examples of the server-side scripts in /examples/server_side/scripts,

    Cheers,

    Colin

  • Dylan33Dylan33 Posts: 2Questions: 1Answers: 0

    thanks a lot.

Sign In or Register to comment.