How to get a specifically column by its id?

How to get a specifically column by its id?

prox108prox108 Posts: 6Questions: 4Answers: 0
edited January 25 in Free community support

Hi guys!,

Currently I capture columns to export like this:

`

            extend: 'excel',

            title: 'Report',

            exportOptions: 
                 columns: [':visible :not(:first-child,:nth-child(6))']

`
As you see I only export columns currently visible excepting the first one and the sixth column.

Unfortunately this sixth column is dynamic, meaning it can be in another places sometimes, like in tab 1 it is the sixth, but in tab 2 it is the eight.

Do you know How can I get this column by its id in order to add it to my :not:() function?

Answers

  • allanallan Posts: 61,627Questions: 1Answers: 10,091 Site admin

    You could add an id to the th in the header for that column and then use #myId as the selector. See also Kevin's reply in your other thread on this topic.

    Allan

  • kthorngrenkthorngren Posts: 20,257Questions: 26Answers: 4,761

    This example states that you can use any mix of column-selector options. You should be able to add the column ID to the array, like this:

    columns: [':visible :not(:first-child,:nth-child(6))', '#myColumn']
    

    Kevin

Sign In or Register to comment.