Show pageBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== DataTables Sorting ====== There are two options that control the sorting, and they are ''bsort'' and ''order''. Note that the index of columns of the DataTables is start with 0. I.e. The index of the first column is 0. ===== No Sorting ===== Adding ''bSort: false'' in option. Example: <code> var table = $("#table").DataTable({ dom: 'rti', pageLength: -1, bSort: false }); </code> ===== Sorting According to the First Column, in Ascending Order ===== Adding ''%%order: [[0, "asc"]]%%'' in option. Example: <code> var table = $("#table").DataTable({ dom: 'rti', pageLength: -1, order: [[0, "asc"]] }); </code> ===== Sorting According to the First Column, in Descending Order ===== Adding ''%%order: [[0, "desc"]]%%'' in option. Example: <code> var table = $("#table").DataTable({ dom: 'rti', pageLength: -1, order: [[0, "desc"]] }); </code> ===== Sorting for Multiple Columns ===== ''order'' option actually accepts an array of input. If we want to sort the first column in descending order, and second column in ascending order, we can use ''%%order: [[0, "desc"], [1, "asc"]]%%'' in option. Example: <code> var table = $("#table").DataTable({ dom: 'rti', pageLength: -1, order: [[0, "desc"], [1, "asc"]] }); </code> datatables_sorting.txt Last modified: 2018/09/26 10:13by chongtin