column visibility & custom header

column visibility & custom header

lalounelaloune Posts: 16Questions: 3Answers: 0

Hello,

I have the following from an older post, that is working properly:

https://jsfiddle.net/fzsux9yq/1/

I try to hide the second column, for that I uncomment the row 60:
table.column(1).visible(false);

but the header does not follow : I supposed that it is set before launching the visibily order.

Would it then be possible to adapt the thead after the initialization ? My ultimate goal is to pass a list of columns that must be shown. I tried using destroy / empty but I struggle with those, so maybe an alternative using visibility

thanks in advance!

Replies

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    It's because you're cloning a table element after the initialisation, so DataTables has no knowledge of it. It would be better to do something like this - so the headers are present before the initialisation,

    Colin

  • lalounelaloune Posts: 16Questions: 3Answers: 0

    hello Colin,

    thanks for your response and the example!

    I finally managed to solve the problem by destroying the table and recreate it again, since the source changes

Sign In or Register to comment.