1

I have a JQuery data table with sorting,searching and page row limit functions. Searching is working fine.

But sorting and page row limit function is not working firstly loaded page. If i search something and try page row limit function and sorting then working fine.

My script code:

<script>
$(document).ready(function() {
    $('#dataTables-example').dataTable({
        "serverside": true,
        "searching": true,
        "ordering": true,
        "deferLoading": 57,
        "displayStart": 20,
        "order":[2, "asc"]

    });

});
</script>

(this script is after the table html code.)

I can't figure out the error here. please help me.

Sebastianb
  • 2,020
  • 22
  • 31
tenten
  • 1,276
  • 2
  • 26
  • 54

1 Answers1

0

Shouldn't you use "DataTable" instead of "dataTable"?

$(document).ready(function() {
    $('#dataTables-example').DataTable();
});

dataTable() vs. DataTable() - why is there a difference and how do I make them work together?

https://datatables.net/forums/discussion/23540/datatable-vs-datatable

There is also an example for the order function with DataTable: https://datatables.net/examples/basic_init/table_sorting.html

Community
  • 1
  • 1
Marcin Restel
  • 280
  • 3
  • 13