Skip to content

Cell Focus

Module Extensions

ColumnRegular (Extended from @revolist/revogrid)

interface ColumnRegular {
/**
* The focus function for the column.
*/
focus?: (detail: BeforeSaveDataDetails) => boolean
}

Plugin API

CellColumnFocusVerifyPlugin

The CellColumnFocusVerifyPlugin is a RevoGrid plugin that enables custom focus verification logic for cells based on their column configurations. This plugin intercepts the cell focus initialization event to apply additional validation rules defined at the column level, ensuring that only cells meeting specific criteria can receive focus.

Key Features:

  • Listens to the beforecellfocusinit event, allowing for pre-focus validation.
  • Utilizes column-level focus functions to determine whether a cell can be focused.
  • Prevents default focus behavior if the column’s focus condition is not satisfied, enabling dynamic user interaction control based on custom logic.

Usage:

  • Integrate this plugin into RevoGrid by adding it to the grid’s plugin array.
  • Define custom focus validation logic within the column definition using the focus property, which should be a function that returns a boolean based on the event detail.

Example

import { CellColumnFocusVerifyPlugin } from './cell-column-focus-verify';
const grid = document.createElement('revo-grid');
grid.plugins = [CellColumnFocusVerifyPlugin];
grid.columns = [
{
prop: 'num',
name: 'Numeric Column',
focus: (detail) => detail.value > 10, // Custom focus validation logic
},
];
class CellColumnFocusVerifyPlugin {}