Hide column based on column header.
Hide column based on column header.
Hi,
Is there a way to do this?
I am currently doing this, to hide the last column:
"columnDefs": [
                {
                    "targets": [-1],
                    "visible": false,
                    "searchable": false
                },
Now I would prefer to hide it based on the column header (field name).
One of my columns dictates what colour the row should be highlighted and I want to be able to hide it, based on it's name.
Mick
This question has an accepted answers - jump to answer
This discussion has been closed.
            
Answers
you could do it in initComplete callback
Yes - you can't select columns based on the name during initialisation I'm afraid (unless you do some jQuery trickery). You need to use a callback function as @bindrid says.
Allan
I cheated and worked out the index in PHP, then passed it in:
Mick