Hide several columns for "colvis" button list
Hide several columns for "colvis" button list
Vasilii
Posts: 9Questions: 1Answers: 0
I need to hide several columns from the list of the colvis button.
columns: ':gt(2)' - works, but it hides all 3 columns before the column #3 (and I just need to hide column #3). Is there a way to pass an array of the columns that must be hidden to this funtion? For example, I want to hide columns #3, #5, #9
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hello @Vasilii , could you post the section of code where you are setting this so that I can look through it. Thanks
Hi @Vasilii ,
This example here should do trick. It shows how to only add specific columns to the colvis button,
Cheers,
Colin
@colin @MSLtd This is what I have:
If I use ':gt()' it hides some columns that I do not want to hide. If I use ':not(.noVis)' it doesn't work - I still see the empty button in the list of colvis.
What
":gt(Nth)"
does is it gets all of the elements after the specified (nth) element.If Colin can't find the solution to your .noVis problem, I'd recommend using
":eq(Nth)"
or"slice()"
instead.:eq() documentation:
https://www.w3schools.com/jquery/traversing_eq.asp
slice() documentation:
http://api.jquery.com/slice/
https://stackoverflow.com/questions/185966/how-to-select-a-range-of-elements-in-jquery
If you need any assistance with these, just let me know
The best would be to create a test case/fiddle, then we can have a look live.
@colin @MSLtd thank you for your help, but I think, that I've found a solution:
Works perfect
Check with this interactive...jQuery Tutorial