Sort, and list ajax json

Sort, and list ajax json

kezman10kezman10 Posts: 12Questions: 3Answers: 0

good morning, I am finding that I do not quite understand the documentation regarding ajax requests, I am currently making a request and I would like the following:

How do I sort the data by a column? How do I show 50 results per page?

In summary I would like an example where it is used.

I attach my request

  var table = $('#listado').DataTable({

   "ajax": {
   "url": "ticket/functionsList.php?tipo=2",
   "contentType": "application/json",
   "type": "GET",
   "data": function ( d ) {
    return JSON.stringify( d );
  }
}
});

Replies

  • kthorngrenkthorngren Posts: 21,299Questions: 26Answers: 4,945

    How do I sort the data by a column?

    When using Client side processing Datatables will perform the sorting. Click the column header to sort. You can define initial sorting using the order option. You can programmatically change sorting with the order() API.

    How do I show 50 results per page?

    Use the pageLength option to set the initial page length.

    Kevin

Sign In or Register to comment.