Button with ability to select columns

Button with ability to select columns

MadBoyEvoMadBoyEvo Posts: 119Questions: 38Answers: 0

Description of problem:
I use DataTables with large amount of columns 30+ with ScrollX option. Is there a way to create a button of some sort that allows users to limit columns they want to see for given session (or maybe even remember settings over sessions)?

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Is there a way to create a button of some sort that allows users to limit columns they want to see for given session

    Two options:

    1) A custom button that will implement whatever hiding logic you want (use columns().visible() to hide columns, or
    2) Use columnVisibility to set visibility for a set of columns.

    It really depends on how you want to hide what columns and under what conditions.

    ?

    stateSave doe basic state saving, including column visibility. For more control, including multiple states, use the StateRestore extension.

    Allan

  • MadBoyEvoMadBoyEvo Posts: 119Questions: 38Answers: 0

    Well, I would like for user to have checkboxes or something within a list that allow to choose which columns should be there, and which should go away. Since a lot of data may be unnecessary by whoever is looking at it.

    As I see from your answer there's nothign that's mostly built-in, or some sort of extension - and I don't have a skill high enough to pull it off I guess I know my answer :-)

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951
    Answer ✓

    Here are a bunch of column visibility examples. Its part of the Buttons extension.

    Kevin

  • MadBoyEvoMadBoyEvo Posts: 119Questions: 38Answers: 0
Sign In or Register to comment.