DataGridXL - API

CellEditor

Description

The CellEditor handles user input during editing and handles native clipboard events when inactive.

Usage

Your DataGridXL instance contains a property cellEditor.

javascript
// create DataGridXL instance
const grid = new DataGridXL(...);
// work with the CellEditor instance
grid.cellEditor.open();
grid.cellEditor.events.on('input', ...);
NOTE: You don't need to create a CellEditor instance yourself — it is provided by the grid automatically.

Methods

close()

Close cell editor

Fires$close
disable()

Disable cell editor

enable()

Enable cell editor

getValue(): string

Get value of cell editor

ReturnsstringValue inside cell editor
isOpen(): boolean

Check if cell editor is open

ReturnsbooleanReturns `true` if cell editor is open, otherwise `false`.
open(value?)

Open cell editor When value is left out, the editor opens blank

Arguments

value?
stringValue to place in cell editor
Fires$open
prepare(cellCoords)

Prepare cell editor Positions cell editor at cell coords and makes cell value copyable

Arguments

cellCoords
CellCoordsCell coordinates
resize()

Resize cell editor to fit contents

setValue(value)

Set cell editor value

Arguments

value
stringValue to place in cell editor

Events

closeCellEditorEvent

Fires when cell editor closes

Payload

type
string
Type of the event (e.g. 'dblclick', 'contextmenu')
target
CellEditor
Instance that fired the event
copyPassthroughEvent

Fires when native `copy` event is triggered

Payload

type
string
Event name (e.g. 'copy', 'paste')
target
object
Instance that fired the event
nativeEvent
Event
The original DOM event
cutPassthroughEvent

Fires when native `cut` event is triggered

Payload

type
string
Event name (e.g. 'copy', 'paste')
target
object
Instance that fired the event
nativeEvent
Event
The original DOM event
inputPassthroughEvent

Fires when native `input` event is triggered

Payload

type
string
Event name (e.g. 'copy', 'paste')
target
object
Instance that fired the event
nativeEvent
Event
The original DOM event
beforeopenCellEditorOpenEvent

Fires before the editor opens. You may modify `payload` to alter the behavior (e.g. editor positioning or contents). Returning `false` cancels the event.

Payload

type
string
Always `"beforeopen"` or `"open"`
target
CellEditor
Instance that fired the event
payload
CellEditorOpenEventPayload
Structured event data
openCellEditorOpenEvent

Fires when the editor opens

Payload

type
string
Always `"beforeopen"` or `"open"`
target
CellEditor
Instance that fired the event
payload
CellEditorOpenEventPayload
Structured event data
pastePassthroughEvent

Fires when native `paste` event is triggered

Payload

type
string
Event name (e.g. 'copy', 'paste')
target
object
Instance that fired the event
nativeEvent
Event
The original DOM event