Skip to content

BaseEditor

Members

_closeAfterDataChange

Source code

baseEditor._closeAfterDataChange : boolean

Flag to specify if the editor should be closed after data change.

col

Source code

baseEditor.col : number

Visual column index.

EDITOR_TYPE

Source code

BaseEditor.EDITOR_TYPE

Returns the unique editor type identifier for the base editor.

originalValue

Source code

baseEditor.originalValue : *

Original cell’s value.

prop

Source code

baseEditor.prop : number | string

Column property name or a column index, if datasource is an array of arrays.

row

Source code

baseEditor.row : number

Visual row index.

state

Source code

baseEditor.state : string

Editor’s state.

TD

Source code

baseEditor.TD : HTMLTableCellElement

Currently rendered cell’s TD element.

Methods

beginEditing

Source code

baseEditor.beginEditing(newInitialValue, event)

Begins editing on a highlighted cell and hides fillHandle corner if was present.

ParamTypeDescription
newInitialValue*The initial editor value.
eventEventThe keyboard event object.

cancelChanges

Source code

baseEditor.cancelChanges()

Finishes editing without saving value.

close

Source code

baseEditor.close()

Required method to close editor.

discardEditor

Source code

baseEditor.discardEditor(result)

Verifies result of validation or closes editor if user’s canceled changes.

ParamTypeDescription
resultboolean
undefined
If false and the cell using allowInvalid option, then an editor won’t be closed until validation is passed.

enableFullEditMode

Source code

baseEditor.enableFullEditMode()

Switch editor into full edit mode. In this state navigation keys don’t close editor. This mode is activated automatically after hit ENTER or F2 key on the cell or while editing cell press F2 key.

extend

Source code

baseEditor.extend() ⇒ function

Fallback method to provide extendable editors in ES5.

finishEditing

Source code

baseEditor.finishEditing(restoreOriginalValue, ctrlDown, callback)

Finishes editing and start saving or restoring process for the editing cell, or for every selected range.

ParamTypeDescription
restoreOriginalValuebooleanIf true, then closes editor without saving value from the editor into a cell.
ctrlDownbooleanIf true, then saveValue will save editor’s value to each cell in every selected range.
callbackfunctionThe callback function, fired after editor closing.

focus

Source code

baseEditor.focus()

Required method to focus editor.

getEditedCell

Source code

baseEditor.getEditedCell() ⇒ HTMLTableCellElement | null

Gets the HTMLTableCellElement of the edited cell, if it exists.

getEditedCellRect

Source code

baseEditor.getEditedCellRect() ⇒ Object | undefined

Gets the object that provides information about the edited cell size and its position relative to the table viewport.

The rectangle has six integer properties:

  • top The top position relative to the table viewport
  • start The left (or right in RTL) position relative to the table viewport
  • width The cell’s current width;
  • maxWidth The maximum cell’s width after which the editor goes out of the table viewport
  • height The cell’s current height;
  • maxHeight The maximum cell’s height after which the editor goes out of the table viewport

getEditedCellsLayerClass

Source code

baseEditor.getEditedCellsLayerClass() ⇒ string

Gets the className of the edited cell, if it exists.

getValue

Source code

baseEditor.getValue()

Required method to get current value from editable element.

init

Source code

baseEditor.init()

Initializes an editor’s intance.

isInFullEditMode

Source code

baseEditor.isInFullEditMode() ⇒ boolean

Checks if editor is in full edit mode.

isOpened

Source code

baseEditor.isOpened() ⇒ boolean

Returns information whether the editor is open.

isWaiting

Source code

baseEditor.isWaiting() ⇒ boolean

Returns information whether the editor is waiting, eg.: for async validation.

open

Source code

baseEditor.open()

Required method to open editor.

prepare

Source code

baseEditor.prepare(row, col, prop, td, value, cellProperties)

Prepares editor’s meta data.

ParamTypeDescription
rownumberThe visual row index.
colnumberThe visual column index.
propnumber
string
The column property (passed when datasource is an array of objects).
tdHTMLTableCellElementThe rendered cell element.
value*The rendered value.
cellPropertiesobjectThe cell meta object (see Core#getCellMeta).

resetValueBeforeEdit

Source code

baseEditor.resetValueBeforeEdit()

Re-arms the unchanged-edit guard after the editor’s content has been reloaded from the data source, so the baseline describes what the editor shows now rather than what it showed when it opened. Does nothing while the guard is disarmed.

saveValue

Source code

baseEditor.saveValue(value, ctrlDown)

Saves value from editor into data storage.

With ctrlDown the value goes into every cell of every selection layer, not only the layer that holds the focus - the same reach the grid’s own Ctrl/Cmd+Enter fill has when no editor is open. The whole fill leaves through one setDataAtCell() call, so it fires one afterChange and costs one undo step however many layers it spans.

ParamTypeDescription
value*The editor value.
ctrlDownbooleanIf true, applies value to each cell in every selected range.

setValue

Source code

baseEditor.setValue()

Required method to set new value into editable element.