How do you show select inputs filtering drop down bar for columns that are hidden by default?

How do you show select inputs filtering drop down bar for columns that are hidden by default?

mma@psesd.orgmma@psesd.org Posts: 1Questions: 1Answers: 0

Hello, I'm very new to datatables and coding for that matter so please forgive my writing and terminology. I'm still learning. I have been trying my best to put together an in depth filtering library for a school district resource project for the community through all the examples everyone has provided. So far I have: https://codepen.io/mmapsesd/pen/NWNbOLj

I have a bunch of columns that doesn't need to be initially be displayed so I was able to hide it with:
columnDefs: [
{targets:[4,5,6,7], visible: false

However now when I turn these columns back on to be visible within the 'Colvis" toolbar, the columns no longer have the individual column searching select input. It just displays the header title again instead of the drop down. How do I fix this?

Lastly is there also a way to display my "Features" column to be wrapped (on multiple lines within a smaller column) vs 1 long line (wide column) and is there a way to have the individual column searching select input to just recognize and show the hyperlink in the drop down list versus the whole entire paragraph? Thank you so much for your help!

Answers

  • colincolin Posts: 15,151Questions: 1Answers: 2,587

    However now when I turn these columns back on to be visible within the 'Colvis" toolbar, the columns no longer have the individual column searching select input.

    I'm not seeing that in your example. I hid Features, unhid it, and the search was still there and searching correctly. Please can you give steps on how to reproduce that.

    Lastly is there also a way to display my "Features" column to be wrapped (on multiple lines within a smaller column) vs 1 long line

    That would only work if you change your filtering select. As it stands, it has the entire string, so whatever you do in the table's cell, that select would still be full width.

    Colin

  • kthorngrenkthorngren Posts: 20,329Questions: 26Answers: 4,774
    edited August 2020

    Use the column-visibility event. Rebuild the column select lists similar to what you have in initComplete.

    Kevin

This discussion has been closed.