BaseEditor
Members
_closeAfterDataChange
baseEditor._closeAfterDataChange : boolean
Flag to specify if the editor should be closed after data change.
col
baseEditor.col : number
Visual column index.
EDITOR_TYPE
BaseEditor.EDITOR_TYPE
Returns the unique editor type identifier for the base editor.
originalValue
baseEditor.originalValue : *
Original cell’s value.
prop
baseEditor.prop : number | string
Column property name or a column index, if datasource is an array of arrays.
row
baseEditor.row : number
Visual row index.
state
baseEditor.state : string
Editor’s state.
TD
baseEditor.TD : HTMLTableCellElement
Currently rendered cell’s TD element.
Methods
beginEditing
baseEditor.beginEditing(newInitialValue, event)
Begins editing on a highlighted cell and hides fillHandle corner if was present.
| Param | Type | Description |
|---|---|---|
| newInitialValue | * | The initial editor value. |
| event | Event | The keyboard event object. |
cancelChanges
baseEditor.cancelChanges()
Finishes editing without saving value.
close
baseEditor.close()
Required method to close editor.
discardEditor
baseEditor.discardEditor(result)
Verifies result of validation or closes editor if user’s canceled changes.
| Param | Type | Description |
|---|---|---|
| result | boolean undefined | If false and the cell using allowInvalid option, then an editor won’t be closed until validation is passed. |
enableFullEditMode
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
baseEditor.extend() ⇒ function
Fallback method to provide extendable editors in ES5.
finishEditing
baseEditor.finishEditing(restoreOriginalValue, ctrlDown, callback)
Finishes editing and start saving or restoring process for the editing cell, or for every selected range.
| Param | Type | Description |
|---|---|---|
| restoreOriginalValue | boolean | If true, then closes editor without saving value from the editor into a cell. |
| ctrlDown | boolean | If true, then saveValue will save editor’s value to each cell in every selected range. |
| callback | function | The callback function, fired after editor closing. |
focus
baseEditor.focus()
Required method to focus editor.
getEditedCell
baseEditor.getEditedCell() ⇒ HTMLTableCellElement | null
Gets the HTMLTableCellElement of the edited cell, if it exists.
getEditedCellRect
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:
topThe top position relative to the table viewportstartThe left (or right in RTL) position relative to the table viewportwidthThe cell’s current width;maxWidthThe maximum cell’s width after which the editor goes out of the table viewportheightThe cell’s current height;maxHeightThe maximum cell’s height after which the editor goes out of the table viewport
getEditedCellsLayerClass
baseEditor.getEditedCellsLayerClass() ⇒ string
Gets the className of the edited cell, if it exists.
getValue
baseEditor.getValue()
Required method to get current value from editable element.
init
baseEditor.init()
Initializes an editor’s intance.
isInFullEditMode
baseEditor.isInFullEditMode() ⇒ boolean
Checks if editor is in full edit mode.
isOpened
baseEditor.isOpened() ⇒ boolean
Returns information whether the editor is open.
isWaiting
baseEditor.isWaiting() ⇒ boolean
Returns information whether the editor is waiting, eg.: for async validation.
open
baseEditor.open()
Required method to open editor.
prepare
baseEditor.prepare(row, col, prop, td, value, cellProperties)
Prepares editor’s meta data.
| Param | Type | Description |
|---|---|---|
| row | number | The visual row index. |
| col | number | The visual column index. |
| prop | number string | The column property (passed when datasource is an array of objects). |
| td | HTMLTableCellElement | The rendered cell element. |
| value | * | The rendered value. |
| cellProperties | object | The cell meta object (see Core#getCellMeta). |
resetValueBeforeEdit
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
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.
| Param | Type | Description |
|---|---|---|
| value | * | The editor value. |
| ctrlDown | boolean | If true, applies value to each cell in every selected range. |
setValue
baseEditor.setValue()
Required method to set new value into editable element.