Input Interaction

interface DataEditorProps {
    
    // ...other props
    
    keybindings?: Partial<Keybinds>;
    maxColumnAutoWidth?: number;
    maxColumnWidth?: number;
    minColumnWidth?: number;
    onCellActivated?: ((cell) => void);
    onCellClicked?: ((cell, event) => void);
    onCellContextMenu?: ((cell, event) => void);
    onColumnMoved?: ((startIndex, endIndex) => void);
    onColumnResize?: ((column, newSize, colIndex, newSizeWithGrow) => void);
    onColumnResizeEnd?: ((column, newSize, colIndex, newSizeWithGrow) => void);
    onColumnResizeStart?: ((column, newSize, colIndex, newSizeWithGrow) => void);
    onGroupHeaderClicked?: ((colIndex, event) => void);
    onGroupHeaderContextMenu?: ((colIndex, event) => void);
    onGroupHeaderRenamed?: ((groupName, newVal) => void);
    onHeaderClicked?: ((colIndex, event) => void);
    onHeaderContextMenu?: ((colIndex, event) => void);
    onHeaderMenuClick?: ((col, screenPosition) => void);
    onItemHovered?: ((args) => void);
    onKeyDown?: ((event) => void);
    onKeyUp?: ((event) => void);
    onMouseMove?: ((args) => void);
    onRowMoved?: ((startIndex, endIndex) => void);
    preventDiagonalScrolling?: boolean;
    rowSelectionMode?: "auto" | "multi";
    
    // ...other props
    
}

keybindings

Key Combo
Default
Flag
Description

Arrow

βœ”οΈ

N/A

Moves the currently selected cell and clears other selections

Shift + Arrow

βœ”οΈ

N/A

Extends the current selection range in the direction pressed.

Alt + Arrow

βœ”οΈ

N/A

Moves the currently selected cell and retains the current selection

Ctrl/Cmd + Arrow | Home/End

βœ”οΈ

N/A

Move the selection as far as possible in the direction pressed.

Ctrl/Cmd + Shift + Arrow

βœ”οΈ

N/A

Extends the selection as far as possible in the direction pressed.

Shift + Home/End

βœ”οΈ

N/A

Extends the selection as far as possible in the direction pressed.

Ctrl/Cmd + A

βœ”οΈ

selectAll

Selects all cells.

Shift + Space

βœ”οΈ

selectRow

Selecs the current row.

Ctrl + Space

βœ”οΈ

selectCol

Selects the current col.

PageUp/PageDown

βœ”οΈ

pageUp/pageDown

Moves the current selection up/down by one page.

Escape

βœ”οΈ

clear

Clear the current selection.

Ctrl/Cmd + D

❌

downFill

Data from the first row of the range will be down filled into the rows below it

Ctrl/Cmd + R

❌

rightFill

Data from the first column of the range will be right filled into the columns next to it

Ctrl/Cmd + C

βœ”οΈ

copy

Copies the current selection.

Ctrl/Cmd + V

βœ”οΈ

paste

Pastes the current buffer into the grid.

Ctrl/Cmd + F

❌

search

Opens the search interface.

Ctrl/Cmd + Home/End

βœ”οΈ

first/last

Move the selection to the first/last cell in the data grid.

Ctrl/Cmd + Shift + Home/End

βœ”οΈ

first/last

Extend the selection to the first/last cell in the data grid.


maxColumnWidth

If maxColumnWidth is set with a value greater than 50, then columns will have a maximum size of that many pixels. If the value is less than 50, it will be increased to 50. If it isn't set, the default value will be 500.


maxColumnAutoWidth

Sets the maximum width that a column can be auto-sized to. Defaults to maxColumnWidth.


onCellClicked

onCellClicked is called whenever the user clicks a cell in the grid.


onCellActivated

onCellActivated is called whenever the user double clicks, taps Enter, or taps Space on a cell in the grid.


onCellContextMenu


onColumnMoved

onColumnMoved is called when the user finishes moving a column. startIndex is the index of the column that was moved, and endIndex is the index at which it should end up. Note that you have to effect the move of the column, and pass the reordered columns back in the columns property.


onColumnResize

onColumnResize is called when the user is resizing a column. newSize is the new size of the column. Note that you have change the size of the column in the GridColumn and pass it back to the grid in the columns property. onColumnReizeEnd is called with the same arguments, but only once the user ceases interaction with the resize handle.

onColumnResizeStart

onColumnResizeStart is called when the user starts resizing a column. newSize is the new size of the column.

onColumnResizeEnd

onColumnResize is called when the user ends resizing a column. newSize is the new size of the column.


onGroupHeaderClicked

Emitted whenever a group header is clicked.


onGroupHeaderContextMenu

Emitted whenever a group header's context menu should be presented, usually right click.


onHeaderClicked

Emitted whenever a header is clicked.


onHeaderContextMenu

Emitted whenever a column header's context menu should be presented, usually right click.


onHeaderMenuClick

onHeaderMenuClick is called when the user clicks the menu button on a column header. col is the column index, and screenPosition is the bounds of the column header. You are responsible for drawing and handling the menu.


onItemHovered

onItemHovered is called when the user hovers over a cell, a header, or outside the grid.


onMouseMove

Emitted any time the mouse moves. Most behaviors relying on this should be debounced for performance reasons.


onRowMoved

Called whenever a row re-order operation is completed. Setting the callback enables re-ordering by dragging the first column of a row.


preventDiagonalScrolling

Set to true to prevent any diagonal scrolling.


rowSelectionMode

rowSelectionMode changes how selecting a row marker behaves. In auto mode it adapts to touch or mouse environments automatically, in multi-mode it always acts as if the multi key (Ctrl) is pressed.


validateCell

When returns false indicates to the user the value will not be accepted. When returns a new GridCell the value is coerced to match.

Last updated

Was this helpful?