Hide Columns for complex header structure
Hide Columns for complex header structure
I have a datatable structure where i have nested headers upto 3 levels and more.
I want to create a functionality where a button is given in the datatable editor when we click on that it shows a popup with switch button to show or hide the columns and individual column names. Its working fine with the 3rd level columns. But I want the same feature at 2nd and 1st level as well. So that all columns under the top level column colspan gets hidden on turning off the switch and so on. Below is the screen show of the problem statement
In the screenshot above the hide columns button hides the individual columns. Hide colspan columns button show show the columns with colspan where the header text is not blank.
Answers
columnToggle
is the button type for this. You need to specify a column selector so it will pick the columns that the button operates on. Unlikecolvis
there isn't an option to have it automatically detect spanning columns.Allan
@allan I can have more than 1 month in this case. It is for a project and the project can lasts upto 5 years. So i can't have those many buttons. Can we have a different approach for this where I can group by year and then by month.
columnToggle
is completely flexible, you can specify whatever columns you want with it. So for example you could have a button that would toggle each year.Perhaps another option would be to have a
collection
for each year, with a master toggle button, and then an individual button for each year.It might take a little bit of code to set those buttons up, but it might be quite effective based on the description of what you are looking for.
Allan
But isn't that too many buttons like 24 button to show. No one will be clicking those many buttons to be honest.
In that case I'm not sure what you want. I perhaps haven't understood your requirements. Perhaps you can draw / sketch what it is that you are looking for?
Allan
This is how I want my hide columns to be precise
That looks like what ColVis would do. I've used ticks rather than the sliders for the active state, but aside from that, you've got one button per column, which is exactly what it does.
Allan