Topic: Datatables Natural Sort
BWBama85
free
asked 5 years ago
I am currently using this code:
<script>jQuery(document).ready(function () {
jQuery('#dtSort').DataTable({
columnDefs: [
{ type: 'natural-nohtml', targets: 3 }
],
"iDisplayLength": 25
});
jQuery('.dataTables_length').addClass('bs-select');
});</script>
To sort Naturally on this page: https://www.bamapolitics.com/alabama/alabama-government-officials/alabama-state-senators/
I'd like for:
- The arrows in the starts in the first colum (0) instead of the fourth column (3).
- I'd like to disable to first column.
Ozcan Arslan
pro
answered 5 years ago
Add this part and you can enable/disable column behaivours and to say which column is sorted as default
"aaSorting": [[3, "desc"]],
"aoColumns": [
/* column1 */ {"bSearchable": false, "bSortable": false},
/* column2 */ {"bSearchable": true, "bSortable": true},
/* column3 */ {"bSearchable": true, "bSortable": false},
/* column4 */ {"bSearchable": false, "bSortable": true},
/* column5 */ {"bSearchable": true, "bSortable": true}
.
.
.
]
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Answered
Specification of the issue
- ForumUser: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.7.3
- Device: Desktop
- Browser: Chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: Yes
Jakub Strebeyko staff commented 5 years ago
Hi there, @BWBama85 Thanks for reaching out! 1. I want to clarify which arrows do you exactly mean? 2. I am afraid there is no way to disable chosen columns as of time being.
Best, Kuba