Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

80
Visualizações
Export from datatable only selected columns

I am trying to export a datatable to a excel, pdf and just to copy it. But i just want to export the selected columns from colvis. When i am exporting the table, it always shows me the full datatable. Where is my mistake?

Thx

<script type="text/javascript" language="javascript">
    $(document).ready(function() {
        $('#tbl').DataTable( {
        dom: 'lBfrtip', 
        language: {
            searchBuilder: {
                button: 'Filter',
            }
        },
        buttons:[
            'searchBuilder',
            {
            extend: 'colvis',
                collectionLayout: 'fixed columns',
                collectionTitle: 'Spalten Auswahl'
            },
            {
            extend: 'copy',
            text: 'Copy',
            exportOptions: {
                modifier: {
                    columns: ':visible'
                }
            }
        }, {
            extend: 'excel',
            text: 'Excel',
            exportOptions: {
                modifier: {
                    columns: ':visible'
                }
            }
        }, 'pdf'        
        ],       
        colReorder: true
        //scrollX: true,
    });
}); 
</script>
almost 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Instead of this:

exportOptions: {
  modifier: {
    columns: ':visible'
  }
}

Just use this:

exportOptions: {
  columns: ':visible'
}

An example is provided here: Export options - column selector. This is for the print button, but it is the same for the other buttons.

columns: The column selector to use. Default - all columns.

The modifier option is used to control something different:

modifier: How the ordering and search state of the table should be applied. Default - {search: 'applied', order: 'applied'}

almost 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda