Trilium Frontend API
    Preparing search index...

    Interface CellComponent

    interface CellComponent {
        cancelEdit: () => void;
        checkHeight: () => void;
        clearEdited: () => void;
        clearValidation: () => void;
        edit: (ignoreEditable?: boolean) => void;
        getColumn: () => ColumnComponent;
        getData: (
            transformType?: "data" | "download" | "clipboard",
        ) => { [key: string]: any };
        getElement: () => HTMLElement;
        getField: () => string;
        getInitialValue: () => any;
        getOldValue: () => any;
        getRow: () => RowComponent;
        getTable: () => Tabulator;
        getType: () => "header" | "cell";
        getValue: () => any;
        isEdited: () => boolean;
        isValid: () => boolean | Validator[];
        navigateDown: () => void;
        navigateLeft: () => boolean;
        navigateNext: () => boolean;
        navigatePrev: () => boolean;
        navigateRight: () => boolean;
        navigateUp: () => void;
        popup: (contents: string, position: PopupPosition) => void;
        restoreInitialValue: () => any;
        restoreOldValue: () => any;
        setValue: (value: any, mutate?: boolean) => void;
        validate: () => boolean | Validator[];
        getRanges(): RangeComponent[];
    }
    Index

    Properties

    cancelEdit: () => void

    You and programmatically cancel a cell edit that is currently in progress by calling the cancelEdit function.

    checkHeight: () => void

    If you are making manual adjustments to elements contained withing the cell, or the cell itself, it may sometimes be necessary to recalculate the height of all the cells in the row to make sure they remain aligned. Call the checkHeight function to check if the height of the cell has changed and normalize the row if it has.

    clearEdited: () => void

    The clearEdited can be called on a Cell Component to clear the edited flag used by the isEdited function and mark the cell as unedited.

    clearValidation: () => void

    The clearValidation can be called on a Cell Component to clear the invalid flag used by the isValid function and mark the cell as valid.

    edit: (ignoreEditable?: boolean) => void

    You and programmatically cause a cell to open its editor element using the edit function.

    getColumn: () => ColumnComponent

    The getColumn function returns the ColumnComponent for the column that contains the cell.

    getData: (
        transformType?: "data" | "download" | "clipboard",
    ) => { [key: string]: any }

    The getData function returns the data for the row that contains the cell.

    getElement: () => HTMLElement

    The getElement function returns the DOM node for the cell.

    getField: () => string

    The getField function returns the field name for the column that contains the cell.

    getInitialValue: () => any
    getOldValue: () => any

    The getOldValue function returns the previous value of the cell. Very useful in the event of cell update callbacks.

    getRow: () => RowComponent

    The getRow function returns the RowComponent for the row that contains the cell.

    getTable: () => Tabulator

    The getTable function returns the Tabulator object for the table containing the cell.

    getType: () => "header" | "cell"

    The getType function can be used to determine if the cell is being used as a cell or a header element.

    getValue: () => any

    The getValue function returns the current value for the cell.

    isEdited: () => boolean

    You can call the isEdited function on any Cell Component to see if it has been edited. it will return true if it has been edited or false if it has not.

    isValid: () => boolean | Validator[]

    The isValid can be called on a Cell Component to check if a cell has previously passed a validation check without revalidating it. Returns true if the cell passes validation, or an array of failed validators if it fails validation.

    navigateDown: () => void

    down - move to the same cell in the row below

    navigateLeft: () => boolean

    left - next editable cell on the left, return false if none available on row

    navigateNext: () => boolean

    next - next editable cell on the right, if none available move to left most editable cell on the row below

    navigatePrev: () => boolean

    prev - next editable cell on the left, if none available move to the right most editable cell on the row above.

    navigateRight: () => boolean

    right - next editable cell on the right, return false if none available on row

    navigateUp: () => void

    up - move to the same cell in the row above.

    popup: (contents: string, position: PopupPosition) => void
    restoreInitialValue: () => any
    restoreOldValue: () => any

    The restoreOldValue reverts the value of the cell back to its previous value, without triggering any of the cell edit callbacks.

    setValue: (value: any, mutate?: boolean) => void

    You can change the value of the cell using the setValue function. The first parameter should be the new value for the cell, the second optional parameter will apply the column mutators to the value when set to true (default = true).

    validate: () => boolean | Validator[]

    You can validate a cell by calling the validate method on any Cell Component. Returns true if the cell passes validation, or an array of failed validators if it fails validation.

    Methods

    • You can retrieve all ranges that overlap a cell by calling the getRanges function:

          var ranges = cell.getRanges();
      

      This will return an array of Range Components for any ranges that overlap the cell. If no ranges overlap the cell, an empty array will be returned.

      Returns RangeComponent[]