Skip to content

Type Editor


Type Editor / @type-editor/tables / utils/col-count / colCount

Function: colCount()

ts
function colCount($pos): number;

Defined in: tables/src/utils/col-count.ts:21

Gets the column index of the cell at the given position.

For cells that span multiple columns, this returns the index of the leftmost column the cell occupies.

Parameters

ParameterTypeDescription
$posResolvedPosA resolved position pointing at or within a cell.

Returns

number

The zero-based column index of the cell.

Example

typescript
const column = colCount($cellPos);
console.log(`Cell is in column ${column}`);