• Resolved jcm01

    (@jcm01)


    Hi Tobias,

    Is it possible to hide specific columns by default, but give visitors the option to un-hide the columns they wish to see.

    An example would be colvis with a default setting.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    You could maybe take a look at the colvis feature of the TablePress DataTables Buttons Extension from https://tablepress.org/extensions/datatables-buttons/ for this.
    Then, if you combine that with a “Custom Command” (on the table’s “Edit” screen) like

    "columnDefs": [ { "visible: false, "targets": [ 3, 5 ] } ]
    

    you could hide columns when the table is loaded and make the visible again later.

    Regards,
    Tobias

    Thread Starter jcm01

    (@jcm01)

    Hi,

    Once again, thanks for the quick answer.

    You actually helped more than you think. With your code and a little research, I now have a better understanding of I can enter into the Custom Commands field and managed to come up with the below piece of code ??

    "dom": "BWlfrtip",
    "columnDefs": [ 
    	{"visible": true, "targets": [0,1,2,3,4,5,6,7,8,9]},
    	{"visible": false, "targets": '_all'},
    	{"searchable": false, "targets": [1,2]}
    ]

    Thanks

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!

    Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide columns by default, with option to show’ is closed to new replies.