Trying to translate both Datatables and editor. I only can get one translation working
Trying to translate both Datatables and editor. I only can get one translation working
luispozoquerol
Posts: 3Questions: 2Answers: 0
Code below translate DATATABLE but submits from EDITOR are not shown. When I delete language script in datatables submits form Editor translator works fine
<script type="text/javascript" language="javascript" class="init">
var editor; // use a global for the submit and return data rendering
$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
ajax: "/api/usuarios",
table: "#myTable",
fields: [ {
label: "id_usuario:",
name: "id_usuario"
}, {
label: "ipn:",
name: "ipn"
}, {
label: "nombre:",
name: "nombre"
}, {
label: "perfilq:",
name: "perfilq"
}, {
label: "anulado:",
name: "anulado"
}, {
label: "fecha anulado:",
name: "fecha_anulado",
type: 'datetime'
}, {
label: "manager:",
name: "manager"
}, {
label: "empresas:",
name: "empresas"
}, {
label: "concesiones:",
name: "concesiones"
}
],
i18n: {
create: {
button: "Nuevo",
title: "Crar nueva entrada",
submit: "Nuevo"
},
edit: {
button: "Modificar",
title: "Modificar entrada",
submit: "Actualizar"
},
remove: {
button: "Suprimir",
title: "Suprimir",
submit: "Suprimir",
confirm: {
_: "¿Está seguro que desea eliminar esta fila %d?",
1: "¿Está seguro de que desea eliminar 1 fila?"
}
},
error: {
system: "Error, contacte con su administrador de sistemas"
},
datetime: {
previous: 'Anterior',
next: 'Siguiente',
months: [ 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre' ],
weekdays: [ 'Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab' ]
}
}
} );
var table = $('#myTable').DataTable( {
lengthChange: false,
pageLength: 25,
ajax: "/api/usuarios",
columns: [
{ data: "id_usuario" },
{ data: "ipn" },
{ data: "nombre" },
{ data: "perfilq" },
{ data: "anulado" },
{ data: "fecha_anulado" },
{ data: "manager" },
{ data: "empresas" },
{ data: "concesiones" }
],
select: true,
language: {
"url": "Spanish.json",
},
} );
// Display the buttons
new $.fn.dataTable.Buttons( table, [
{ extend: "create", editor: editor },
{ extend: "edit", editor: editor },
{ extend: "remove", editor: editor }
] );
table.buttons().container()
.appendTo( $('.col-md-6:eq(0)', table.table().container() ) );
} );
</script>
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Answers
It seems to be working here as expected, using your code. Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.
Cheers,
Colin