Demonstrates: (Slick.Plugins.ContextMenu / Slick.Plugins.CellMenu)

  • Slick.Plugins.ContextMenu - Context Menu (global from any columns right+click)
  • This plugin subscribes internally to the "onContextMenu" event
  • Mouse Right-Click the row to open a Context Menu (global any columns)
  • The context menu showing on left columns will show only commands (from Title to EffortDriven)
  • The context menu showing on Priority column will show list of options that will be applied to the Priority cell
  • You can dynamically change the behavior and show Commands & Options over the Priority column (choose option below, then try it over Priority column)
  • Slick.Plugins.CellMenu - Cell Menu (from a single cell click)
  • The "Action" column is demoing this functionality
  • This plugin subscribes internally to the "onClick" event
  • Regular Cell Click (left mouse or touch) will open a Cell Menu
  • It will also "autoAdjustDrop" (bottom/top) and "autoAlignSide" (left/right)
  • Very similar to the global Context Menu except that it's on a single cell click instead of a right+click
  • Uses the same context menu structure as the global one but is defined on a column definition level
  • A good usage example is with an "Action" button/cell as shown in the grid
  • Note that the Action text is just a placeholder, user can click anywhere in the cell to trigger the action.
  • Common Features
  • It will also "autoAdjustDrop" (bottom/top) and "autoAlignSide" (left/right) by default but could be turned off
  • There are 2 sections, the first section can have an Options array (change value of a field) and second section can have an array of Commands (execute a command)
  • These 2 lists are static arrays and are not meant to be dynamic however you can...
  • Use override callback functions to change show/hide, enable/disable, use/block certain item(s)
  • These callbacks are: "menuUsabilityOverride", "itemVisibilityOverride", "itemUsabilityOverride"
  • ... e.g. in the demo, the "Action" menu is only available when Priority is set to "High" via "menuUsabilityOverride"
  • There are many properties available for each list items: disabled, divider, tooltip, cssClass, iconCssClass, iconImage
  • There are also a few SlickGrid Events you can subscribe onBeforeMenuShow, onBeforeMenuClose, onAfterMenuShow, onCommand, onOptionSelected
  • There 2 ways to execute a Command/Option
    1. via onCommand/onOptionSelected (use a switch/case to parse command/option and do something with it)
    2. via action callback (must be defined on each command/option)
  • Each Command/Option have full knowledge of the column definition, data context object and are available arguments of the subsribe events (or action callback)
  • Lots of options, looks at each plugin to see the entire list of options available

View Source: