Reputation: 717
In this code:
$('#example').dataTable( {
"columnDefs": [ {
"targets": 0,
"searchable": false
} ]
} );
targets has been given a column index. But in my case, columns can be in varying orders. So my question is, can "targets" be given the name of the column parameter and if so, how?
Upvotes: 15
Views: 43348
Reputation: 17550
From the documentation (emphasis mine):
This
targets
property tells DataTables which column(s) the definition should be applied to. It can be:
- 0 or a positive integer - column index counting from the left
- A negative integer - column index counting from the right
- A string - class name will be matched on the TH for the column
- The string "_all" - all columns (i.e. assign a default)
Upvotes: 24