-
Notifications
You must be signed in to change notification settings - Fork 0
21 DataTables Change Options
M. Fares edited this page Apr 6, 2018
·
1 revision
- To disable sorting on the fourth column, give the targets the value 3. The first column is 0.
$('#employeesTable').dataTable( {
"columnDefs": [
{ "orderable": false, "targets": 3 }
]
} );- The last column is also indicated by the index -1
$('#employeesTable').dataTable( {
"columnDefs": [
{ "orderable": false, "targets": -1 }
]
} );- To disable ordering on multiple columns
$('#employeesTable').dataTable( {
"columnDefs": [
{ "orderable": false, "targets": [1, 3] }
]
} );- To enable horizontal scrolling
$('#example').dataTable( {
"scrollX": true
} );5 To enable vertical scrolling with pagination disabled
$('#example').dataTable( {
"scrollY": "200px",
"scrollCollapse": true,
"paging": false,
"columnDefs": [{ "orderable": false, "targets": 3 }]
} );-
Example: Check the view /Views/Employee/Index.cshtml
-
References:DataTables Examples