Grouping Show/Hide Column Checkboxes

So I have a treegrid, and I want users to be able to not only show and hide columns, I want them to be able to show and hide columns in bulk. Right now, I’m using mygrid.enableHeaderMenu() in order to allow the users to show and hide columns. However, I have about 50 columns, and need to give them the ability to show/hide columns in bulk.

For example, a sample of my columns would be:

  • foo
  • bar
  • baz
  • unrelated

I want users to be able to show/hide the foo, bar, and baz columns using one checkbox, as well as be able to show/hide each column separately.

Here are some mockups of what I want, in case I’m being unclear:

All of them selected:

If the user clicks on the top checkbox, none of them are selected:

Finally, they can be selected separately:

I know this is available in other grid frameworks, but I was wondering if it was either built into dhtmlx, or if there was a way to modify an already-existing function in order to obtain this feature.

Unfortunately such feature is not available with the default header menu.

You may add your own context menu to the header of your grid on the base of the dhtmlxMenu:

[code] menu = new dhtmlXMenuObject();
menu.renderAsContextMenu();

mygrid.hdrBox.id = “gridHeader”;
menu.addContextZone(“gridHeader”);[/code]

And call the setColumnHidden() method on selecting the required menu options with the required attributes.