combine table tool and colvis

combine table tool and colvis

szdszd Posts: 7Questions: 1Answers: 0

can i combine these two :smile:
dom : 'lBfrtip',
buttons: ['copy', 'csv', 'excel', 'pdf', 'print' ],

and

dom: 'Bfrtip',
buttons: [
{
extend: 'print',
exportOptions: {
columns: ':visible'
}
},
'colvis'
],
columnDefs: [ {
targets: 0,
visible: true
} ]

i want to write something like this so i can choose the column that i want to appear when download the data to excel or pdf

dom: 'Bfrtip',
buttons: [
{
extend: 'copy', 'csv', 'excel', 'pdf', 'print'
exportOptions: {
columns: ':visible'
}
},
'colvis'
],
columnDefs: [ {
targets: 0,
visible: true
} ]

Replies

  • szdszd Posts: 7Questions: 1Answers: 0
    edited November 2016

    i think this is how we write it :smile:

     buttons: [
            {
                extend: 'copy',
                exportOptions: {columns: ':visible'}
    
            },
            {
                extend: 'print',
                exportOptions: {columns: ':visible'}
    
            },
            {
                extend: 'csv',
                exportOptions: {columns: ':visible'}
    
            },
            {
                extend: 'excel',
                exportOptions: {columns: ':visible'}
    
            },
            {
                extend: 'pdf',
                exportOptions: {columns: ':visible'}
    
            },
            'colvis'
        ]
    
  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    Yes, that looks like it should work. Are you happy with that working and you understand why it works?

    Allan

  • szdszd Posts: 7Questions: 1Answers: 0
    edited November 2016

    yes of course, knowing that i've been working on it since two days but it's easy to understand and very nice
    and thank you for your reply :smile:

This discussion has been closed.