hide column by default with colvis?

hide column by default with colvis?

fedeinfedein Posts: 22Questions: 7Answers: 1

Hi!!

I need to hide a column by default using colvis. How can i do?

Thank you!

Regards!!

Answers

  • kthorngrenkthorngren Posts: 20,142Questions: 26Answers: 4,736
  • fedeinfedein Posts: 22Questions: 7Answers: 1

    Hi kthorngren , thank you very much for your answer.

    in that case, for example, if i want to hide the column "name" by default. How can i do that?

    Thanks and regards!!

  • kthorngrenkthorngren Posts: 20,142Questions: 26Answers: 4,736
    edited March 2017

    columnDefs can be used to hide the column. Use { targets: 0, visible: false} to hide the first column.

    @allan I don't think your example to remove name from the visibility list is working.

    Kevin

  • fedeinfedein Posts: 22Questions: 7Answers: 1

    Thank you!!

    But i want set the column "name" hide by default. Then i need to click the colvis button and show the column "name". Is this possible???

    Sorry for my bad English...

    Regards!!

  • kthorngrenkthorngren Posts: 20,142Questions: 26Answers: 4,736

    I think the best you can do is use a class name. Take a look at columnDefs.targets to see all the options for selecting the column.

    Kevin

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    @kthorngren - Completely agree. That's a bug in the current release I'm afraid. The site uses the current release version which is why it is still present there.

    The next Buttons release will fix it. Thanks!

    Also I agree - use columns.visible to hide a column by default.

    Allan

This discussion has been closed.