Header Menu & Header Buttons
Demo
Header Button Plugin
Header Menu Plugin
Header Menu
The Header Menu
is now part of Slickgrid-Universal
and is enabled by default via the grid option "enableHeaderMenu" flag.
How to use it?
It's Enabled by default
Technically, it's enable by default and so you don't have anything to do to enjoy it. However if you want to customize the content of the Header Menu, then continue reading.
Customization
Custom Commands
The Header Menu also comes, by default, with a list of built-in custom commands (all their positionOrder
are in the reserved range of 40 to 60)
Sort Ascending (you can hide it with
hideSortCommands: true
)Sort Descending (you can hide it with
hideSortCommands: true
)Hide Column (you can hide it with
hideColumnHideCommand: true
)
This section is called Custom Commands because you can also customize this section with your own commands. To do that, you need to fill in 2 properties (an array of headerMenuItems
that will go under each column definition and define onCommand
callbacks) in your Grid Options. For example, Slickgrid-Universal
is configured by default with these settings (you can overwrite any one of them):
Callback Hooks
There are 2 callback hooks which are accessible in the Grid Options
onBeforeMenuShow
onCommand
For more info on all the available properties of the custom commands, you can read refer to the doc written in the Grid Menu implementation itself.
How to change icon(s) of the default commands?
You can change any of the default command icon(s) by changing the icon[X-command]
, for example, see below for the defaults.
How to Disable the Header Menu?
You can disable the Header Menu, by calling enableHeaderMenu: false
from the Grid Options.
How to Exclude Header Menu from a Particular Column?
You can exclude a column from getting a Header Menu by calling excludeFromHeaderMenu
in your Column Definition. For example, we don't need it on a column that has an edit icon:
Sample
You can add Header Menu to 1 column or all columns like shown below. You can also add sub-menus by nesting commandItems
Last updated