Is there any possibility to limit the number of characters of a datatable?
For example the row empresa_reparacion
: If the character length is 20 letters, how can I do it so that it shows me 10 letters.
<script>
$(document).ready(function() {
$('#miTabla').DataTable( {
"ajax":{
"url": "Visualizacion_Reparacion/Visualizar_Reparacion_Tracto.php",
"dataSrc":""
},
"columns":[
{"data": "id_reparacion_tracto"},
{"data": "patente_tracto"},
{"data": "empresa_reparacion"},
{"data": "fecha_reparacion"},
{"data": "numero_factura_reparacion", "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
$(nTd).html("<a href='?id="+oData.id_reparacion_tracto+"'>"+oData.numero_factura_reparacion+"</a>");
}
},
{"data": "total_reparacion"},
{"defaultContent": "<button type='button' id= name='codigo' class='btn btn-outline-primary MostrarFactura' data-bs-toggle='modal' data-bs-target='#MostrarFactura'>VISUALIZAR FACTURA</button>"},
{"defaultContent": "<button type='button' id=${elemento.id_tracto} class='btn btn-outline-success'>MODIFICAR</button>"},
{"defaultContent": "<button type='button' id=${elemento.id_tracto} class='btn btn-outline-danger'>ELIMINAR</button>"},
],
"columnDefs": [ {
"targets": 0,
} ]
});
});
</script>
Datatable offers for each column the option to indicate, for example, a function
render
To achieve what you need, you could do the following: