DataSpreadsheet extends DataGrid

An editable DataGrid — the virtualized counterpart to Spreadsheet.

Constructor

new DataSpreadsheet()
options : Object optional
data : Array optional

records; one DataGridRow per record

columns : Array optional

column configs (DataGridColumn)

rowHeight : number optional

estimated height for unmeasured rows

defaultColumnWidth : number optional

width for columns without width

overscan : number optional

extra rows mounted above/below the viewport

content : string | HTMLElement | Array | Object optional

content to append to element. Passed to Dolla's content

Instance Properties

Every cell as a CellHandle (lazy, transient — see plan §1.1).

Row controllers currently in the window.

Static Properties

Attributes settable via constructor options. Each key is the attribute name and the value is a schema object describing how to handle it.

Example

static assignableAttributes = {
    anchor: { type: 'HTMLElement', default: null, null: true },
    placement: { type: 'string', default: 'bottom', null: false },
    enabled: { type: 'boolean', default: true, null: false },
    data: { type: 'array', default: [], null: false }
}

Properties

type : string | Array.<string>

expected type(s): 'string', 'number', 'boolean', 'object', 'array', 'function', or a class/element name like 'HTMLElement'

default : *

default value when none is provided

null : boolean

whether null is an acceptable value

load : function optional

optional transform applied when reading the attribute value

Methods overridable via constructor options

Methods to auto-bind to this

Event names that can be bound via onEventName constructor options

CSS injected once per component via adoptedStyleSheets

CSS @layer name used to wrap the component's styles when injected via adoptedStyleSheets. Set to a falsy value to disable layering.

Attributes to observe for changes. Triggers changed(attribute, was, now) and [attribute]Changed(was, now) callbacks.

Instance Methods

Make cells focusable, set once per physical element (pooled cells keep it).

Begin editing a cell.

Listen for events on another element, automatically cleaned up when this component disconnects

Parameters

element : HTMLElement

element to listen on

eventType : string

event type

args : *

additional arguments passed to addEventListener

Publish the column tracks + total width as custom properties on the grid. The header and every row inherit --dg-template-columns / --dg-width via CSS, so column geometry has a single update point (call this after any column width/order change) instead of writing the template on each row.

F   at()

CellHandle at (column, row); negative indices count from the end.

Called every time an observed attribute changes. Attribute must be listed in static watch.

Parameters

attribute : string

the attribute that changed

was : *

previous value

now : *

new value

Called when element is connected to the DOM

TSV for the current selection — reads from records, so off-screen rows are included.

Called when element is disconnected from the DOM

Called once per instantiation, but only after element is connected to the DOM

Query mounted cells by CSS selector → handles (off-screen cells can't match).

Recompute body size + reposition after a height change (from the observer).

Remove element. Fires remove, calls optional callback, removes from DOM, then fires removed.

Parameters

callback : function optional

async callback called between remove and removed

Returns

The border box around the selection range — solid normally, dashed (.copy) while a copy is pending (the marquee).

Rectangular range of CellHandles between two handles (row-major).

One step from {row,col} in a direction, clamped to the grid.

Trigger an event on this element

Parameters

eventName : string

event name to trigger

args : *

additional arguments

Compute the [start, end] row index range to mount, including overscan.

Events

Fired before the element is connected to the DOM (cancellable)

Fired after the element is connected to the DOM and initialized

Fired before the element is disconnected from the DOM (cancellable)

Fired after the element is disconnected from the DOM

Fired before the element is removed (cancellable)

Fired after the element is removed