Skip to main content

selection

Description​

Optional. Enables/disables the selection of cells

Usage​

selection?: boolean;

Default config​

selection: true

Example​

const spreadsheet = new dhx.Spreadsheet("spreadsheet_container", {
selection: false,
// other config parameters
});

Details​

When the property is set to false:

  • the Spreadsheet has no active cell
  • the cells can't be selected with the mouse, the keyboard or the API: the setSelectedCell() and setFocusedCell() methods are ignored, and the getSelectedCell() and getFocusedCell() methods return undefined
  • the cells can't be edited from the interface: the formula bar is locked, the fill handle is hidden, and the startEdit() method is ignored
  • the context menu and the column menu icon are not available
  • Tab stops on the grid once and moves the focus further, and Ctrl + F6 skips the grid

The columns and rows can still be resized by dragging their borders, and the data can still be changed with the API, for example, with the setValue() method.

Combined with the readonly property, the option turns off the keyboard navigation and the selection that are available in the read-only mode:

const spreadsheet = new dhx.Spreadsheet("spreadsheet_container", {
readonly: true,
selection: false,
// other config parameters
});

To turn the selection off and on at runtime, use the selection.disable() and selection.enable() methods.

Change log: Added in v6.0.4

Related articles: