datatable align center code example
Example 1: server side datatable text center
'columnDefs': [
{
"targets": 0, // your case first column
"className": "text-center",
"width": "4%"
},
{
"targets": 2,
"className": "text-right",
}],
Example 2: datatables columns align
dt-right - Right align text in the header and body.
dt-head-right - Right align text in the header only
dt-body-right - Right align text in the body only.
$('#myTable').DataTable( {
columnDefs: [
{
targets: -1,
className: 'dt-body-right'
}
]
} );