I needo to change Language options in datatable bootstrap, but I do not know how to do it, I saw the documentation in https://datatables.net/manual/i18n and https://datatables.net/plug-ins/i18n/Spanish but it does not work, or I do not know how to apply it to my project vb.
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (1) |
Add this function to the end of your code:
JavaScript
var spanish;
function DataTable_language(id) {
spanish = {
"sProcessing": "Procesando...",
"sLengthMenu": "Mostrar _MENU_ registros",
"sZeroRecords": "No se encontraron resultados",
"sEmptyTable": "Ningún dato disponible en esta tabla",
"sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
"sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
"sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"sInfoThousands": ",",
"sLoadingRecords": "Cargando...",
"oPaginate": {
"sFirst": "Primero",
"sLast": "Último",
"sNext": "Siguiente",
"sPrevious": "Anterior"
},
"oAria": {
"sSortAscending": ": Activar para ordenar la columna de manera ascendente",
"sSortDescending": ": Activar para ordenar la columna de manera descendente"
}
};
id.settings.language = spanish;
}
End JavaScript
Also, call the function before you draw the table for the first time:
function Main()
DataTable_language(DataTable1)
updateTable()
End function
George Henne
NS BASIC Corporation
http://www.nsbasic.com
>I needo to change Language options in datatable bootstrap, but I do not
>know how to do it, I saw the documentation in https://datatables.net/
>manual/i18n and https://datatables.net/plug-ins/i18n/Spanish but it does
>not work, or I do not know how to apply it to my project vb.
>
>
>
>
>
>
Thanks, it works.
But, it only works on the table builder only works on function main.
How do I make it work at any time, since the data varies according to the needs or filters.
function Main()
DataTable_language(DataTable1)
updateTable()
'work
End function
funciton updateTable()
columns1 = [{title:"Nombre"},{title:"Salario"}]
data1 = [["Oscar", "$22"]]
DataTable1.settings.columns = columns1
DataTable1.settings.data = data1
DataTable1.build()
end funciton
Function Button1_onclick()
' does not work
updateTable()
end Function
Function Button2_onclick()
' does not work
columns1 = [{title:"1-Nombre"},{title:"2-Salario"}]
data1 = [["1-Oscar", "2-$22"]]
DataTable1.settings.columns = columns1
DataTable1.settings.data = data1
DataTable1.build()
end Function
Are you having trouble with changing the names of the columns, or the default language of the table itself?
George Henne
NS BASIC Corporation
http://www.nsbasic.com