![image]()
My edit column is not aligned properly. It is not aligned to the rightmost part of the table. It ruins the layout.
How can I make it aligned.
$(document).ready(function () {
$("#users-table").DataTable({
"ajax": {
"url": '@Url.Action("GetList", "Users")',
"type": "GET",
"datatype": "json"
},
"columns": [
{ "data": "ID" },
{ "data": "PERFIL" },
{ "data": "USERCD" },
{ "data": "USERNM" },
{ "data": "USERNIF" },
{ "data": "ABREVIATURA" },
{ "data": "COREACTIVO" },
{ "data": "USERML" },
{ "data": "PERFILWEB" },
{
"render": function (data, type, row) {
let toggleIcon = row.COREACTIVO === "S" ? "" : "";
return " | '" + toggleIcon + "";
}
}
],
"aoSearchCols": [ // Filters table in first load to show only active
null,
null,
null,
null,
null,
null,
{ "sSearch": "S" } // Index 6
],
language: {
search: "Procurar: ",
processing: "A carregar",
lengthMenu: "Mostrar _MENU_ registos",
info: "A mostrar de _START_ a _END_ registos de _TOTAL_ registos",
infoFiltered: "(filtrados _MAX_ registos de total)",
infoEmpty: "A mostrar 0 a 0 registos de 0 registos",
loadingRecords: "A carregar registos...",
zeroRecords: "Nenhum registo para mostrar",
emptyTable: "Tabela vazia",
paginate: {
first: "Primeiro",
previous: "Anterior",
next: "Próximo",
last: "Último"
},
aria: {
sortAscending: ": Ordenar por ordem crescente",
sortDescending: ": Ordenar por ordem decrescente"
}
},
pageLength: 25,
"pagingType": "simple_numbers",
"scrollX": true,
"scrollCollapse": true,
"fixedHeader": true,
fixedColumns: {
leftColumns: 0,
rightColumns: 1
},
dom: "<'row'<'col-sm-6'B><'col-sm-6'f>>"+'rtip',
buttons: [
{
"extend": 'colvis',
"text": '',
"columns": ':not(.permanent)',
className: "colvis"
},
{
text: '',
extend: "pageLength",
className: "show-entries"
},
{
text: '',
extend: 'collection',
className: "filter-active-inactibe-btn",
buttons: [
{
text: "Ativo",
name: "filter-active-btn",
action: function (e, dt, node, config) {
$("#users-table").DataTable().columns(6).search('S').draw();
this.active(true);
$("#users-table").DataTable().button('2-1').active(false);
$("#users-table").DataTable().button('2-2').active(false);
}
},
{
text: "Todos",
name: "filter-all-btn",
action: function (e, dt, node, config) {
$("#users-table").DataTable().columns(6).search("").draw();
this.active(true);
$("#users-table").DataTable().button('2-0').active(false);
$("#users-table").DataTable().button('2-2').active(false);
}
},
{
text: "Inativo",
name: "filter-inactive-btn",
action: function (e, dt, node, config) {
$("#users-table").DataTable().columns(6).search('N').draw();
this.active(true);
$("#users-table").DataTable().button('2-0').active(false);
$("#users-table").DataTable().button('2-1').active(false);
}
}
]
}
],
// Changes the color of the letter to red if the letter is N for COREACTIVO
"createdRow": function (row, data, index) {
if (data.COREACTIVO === "N") {
row.style.backgroundColor = "#ff000055";
}
},
// Defines the visibility of the column ID
"columnDefs": [
{
"targets": [0,6],
"visible": false,
"searchable": true
},
{
"targets": [9],
"className": "text-center",
"width": "50px"
},
{
"targets": [0,1,2,3,4,5,6,7,8],
"width": "20%"
}
]
});
$("#users-table").DataTable().buttons('2-0').active(true);
});