I have a problem with the responsive design of the JQuery DataTables plugin. What I need is the following:
We have the following aspect when it becomes responsive to the browser:
Of course, the problem is that when I checkbox at that time, I open the modal details (as it is as if it was giving the "+"), and in the modal details I do not see the checkbox marked.
What I was looking for is to change the order of the column in the responsive, that is, that the "+" appears in the column of Id.Pieza, and not in the column of the checkbox.
Is this possible? How?
I have tried to reorder the columns with colReorder: {order: [4 , 3, 2, 1, 0] },
but it does not work either.
Greetings.
This is the configuration code of the datatable. If you need any other code you tell me, since it is a web portal and it is huge.
// DATATABLES
var table = $('#tablaDatos').DataTable({
ajax: {
type: 'POST',
url: 'datos.php',
processing: true,
data: function ( d ) {
return $.extend( {}, d, {
//
});
}
},
deferRender: true,
columns: [
{data:
function (data, type, row, meta) {
return '<input type="checkbox" name="losCheckboxes" value="'+data.idPieza+'" style="display: inline;" />';
}
},
{data:"idPieza"},
{data:"numSerie"},
{data:"codigo"},
{data:"nombreAlmacen"},
{data:"estadoPieza"},
{data:"nombreProyecto"},
{data:"nombreProveedor"},
{data:"observaciones"},
{data:"descripArticulo"},
{data:
function (data, type, row, meta) {
return '<button type="button" class="btn btn-primary btn-xs">Añadir Observaciones</button>';
}
}
],
order: [[ 1, "asc" ]],
columnDefs: [
{ "orderable": false, "targets": 0 },
{ "orderable": true, "targets": 1 },
{ "orderable": false, "targets": 2 },
{ "orderable": false, "targets": 3 },
{ "orderable": false, "targets": 4 },
{ "visible": false, "targets": 4 },
{ "orderable": false, "targets": 5 },
{ "orderable": false, "targets": 6 },
{ "orderable": false, "targets": 7 },
{ "orderable": false, "targets": 8 },
{ "orderable": false, "targets": 9 },
{ "orderable": false, "targets": 10 }
],
autoWitdh: false,
pagingType: "full",
responsive: true,
colReorder: {order: [4 , 3, 2, 1, 0] },
autoWidth: false,
searching: false,
dom: 'Bfrtip',
lengthChange: false,
buttons: [],
"oLanguage": {
"sProcessing": "Procesando...",
"sLengthMenu": "Mostrar _MENU_ registros:",
"sZeroRecords": "No se encontraron resultados.",
"sInfo": "Mostrando _START_ a _END_ de _TOTAL_ registros.",
"sInfoEmpty": "Mostrando desde 0 hasta 0 de 0 registros",
"sInfoFiltered": "(filtrado de _MAX_ registros en total)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"oPaginate": {
"sFirst": "Primero",
"sPrevious": "«",
"sNext": "»",
"sLast": "Último"}
}
});