Error while destroying table with hidden column

Error while destroying table with hidden column

WamakshiWamakshi Posts: 11Questions: 4Answers: 1

Hi,
I am facing an error when I try to destroy the table having one of the column visibility as false. Same as here: https://datatables.net/forums/discussion/30070/destroy-table-troubles-with-hidden-columns

Is there a solution to it?

Answers

  • WamakshiWamakshi Posts: 11Questions: 4Answers: 1

    The error I was receiving was: Cannot read property 'style' of undefined.
    I had not added the <th></th> element for the hidden column earlier. Adding that resolved this for me.

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Hi @Wamakshi ,

    I just tried it here, and it's working as expected and not generating the error. Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.

    Cheers,

    Colin

  • WamakshiWamakshi Posts: 11Questions: 4Answers: 1
    edited October 2019

    Hi @colin

    I wasn't able to replicate the exact error in your example here http://live.datatables.net/surawice/5/edit

    But, that was my use case - I needed data to be present for that column (whose value was used in rendering another column's data), but not be visible in html. Here's my example with that error:
    https://jsbin.com/vozapez/edit?html,js,console,output

    Thanks

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394

    You define three columns in your js, but there are only two in your HTML. They have to match.

This discussion has been closed.