Skip to content

Plugin: BaseEditor

Members

BaseEditor

Source code

baseEditor.BaseEditor

_closeAfterDataChange

Source code

baseEditor._closeAfterDataChange : boolean

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

_closeCallback

Source code

baseEditor._closeCallback : function

Callback to call after closing editor.

cellProperties

Source code

baseEditor.cellProperties : object

Object containing the cell’s properties.

col

Source code

baseEditor.col : number

Visual column index.

hot

Source code

baseEditor.hot : Handsontable

A reference to the source instance of the Handsontable.

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 cancelled 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 editing cell or last 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 the last selected range.
callbackfunctionThe callback function, fired after editor closing.

getEditedCell

Source code

baseEditor.getEditedCell() ⇒ HTMLTableCellElement | null

Gets HTMLTableCellElement of the edited cell if exist.

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 className of the edited cell if exist.

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).

saveValue

Source code

baseEditor.saveValue(value, ctrlDown)

Saves value from editor into data storage.

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

setValue

Source code

baseEditor.setValue()

Required method to set new value into editable element.