hide column by default with colvis?

hide column by default with colvis?

fedeinfedein Posts: 8Questions: 3Answers: 1

Hi!!

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

Thank you!

Regards!!

Answers

  • kthorngrenkthorngren Posts: 1,586Questions: 18Answers: 324
  • fedeinfedein Posts: 8Questions: 3Answers: 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: 1,586Questions: 18Answers: 324
    edited March 19

    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: 8Questions: 3Answers: 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: 1,586Questions: 18Answers: 324

    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: 43,187Questions: 1Answers: 5,623 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

Sign In or Register to comment.