Editor - Excel button exportOptions - modifier: {selected: null} invalidates defined columns: []

Editor - Excel button exportOptions - modifier: {selected: null} invalidates defined columns: []

carlopcarlop Posts: 37Questions: 9Answers: 1

Hi, the demo can be viewed at
https://nfctech.eu/datatables/editor-select2-bootstrap.html
The code is

{ extend: 'excel', title: null, exportOptions: {columns: [1, 2, 3, 4]}, className: 'visible-lg-inline-block btn-primary'
          , exportOptions: {modifier: {selected: null}}
          }

I expect that only the first 4 columns defined in

exportOptions: {columns: [1, 2, 3, 4]}

are exported in Excel, but, due to the presence of

exportOptions: {modifier: {selected: null}} 

(that should only allow the export of all the rows and not of the selected ones) all the 8 columns are exported.
If I comment the option

exportOptions: {modifier: {selected: null}} 

everithing works fine and only the first 4 columns are exported.
Any suggestion how to bypass the issue?
Thanks

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951
    Answer ✓

    Have you tried combining them into one exportOptions? Like this:

    { extend: 'excel', title: null, 
      exportOptions: {columns: [1, 2, 3, 4],
                      modifier: {selected: null}
                     }, 
      className: 'visible-lg-inline-block btn-primary'
    }
    

    I think the second is overwriting the first.

    Kevin

  • carlopcarlop Posts: 37Questions: 9Answers: 1

    It works, many thanks.

This discussion has been closed.