Skip to content

Instantly share code, notes, and snippets.

@jhowbhz
Created May 24, 2019 18:35
Show Gist options
  • Save jhowbhz/14db91b8c9314c8eab0c885ccc94f7ec to your computer and use it in GitHub Desktop.
Save jhowbhz/14db91b8c9314c8eab0c885ccc94f7ec to your computer and use it in GitHub Desktop.
datatables
$('#tbl_completa').DataTable({
"dom": "'B'"+"<'row'<'col-xs-6'l><'col-xs-6'f>>\
<'row'<'col-xs-12'<'table-responsive't>r>>\
<'row'<'col-xs-5'i><'col-xs-7'p>>",
buttons: [
{
extend: 'excelHtml5',
text: '<i class="fas fa-file-excel-o"></i>',
titleAttr: 'Exportar Excel'
},
{
extend: 'pdfHtml5',
text: '<i class="fas fa-file-pdf-o"></i>',
titleAttr: 'Exportar PDF'
},
{
extend: 'colvis',
text: '<i class="fas fa-filter"></i>',
titleAttr: 'Filtrar',
},
],
lengthChange: false,
autoFill: true,
destroy: true,
select: { style: 'multi' },
processing: true,
serverSide: true,
ajax: 'CAMINHO_DO_SEU_AJAX',
columns: [
{ data: 'XXXXX', name: 'XXXXX' },
{ data: 'XXXXX', name: 'XXXXX' },
{ data: 'XXXXX', name: 'XXXXX' },
{ data: 'XXXXX', name: 'XXXXX' },
],
"order": [[ 1, "DESC" ]],
'language': {
"lengthMenu": "_MENU_ p/ página",
"search": "Buscar: ",
"loadingRecords": "Carregando...",
"processing": "Processando...",
"info": "Mostrando _START_ a _END_ de _TOTAL_ cotações",
"paginate": {
"first": "Primeiro",
"last": "Último",
"next": "Próximo",
"previous": "Anterior"
},
"zeroRecords": "Opa, nenhum cotação foi localizada.",
},
'paging' : true,
'lengthChange': true,
'searching' : true,
'ordering' : true,
'info' : true,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment