Skip to main content

ISharedMatrix Interface

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/matrix/legacy.

For more information about our API support guarantees, see here.

Signature

export interface ISharedMatrix<T = any> extends IEventProvider<ISharedMatrixEvents<T>>, IMatrixProducer<MatrixItem<T>>, IMatrixReader<MatrixItem<T>>, IMatrixWriter<MatrixItem<T>>, IChannel

Extends: IEventProvider<ISharedMatrixEvents<T>>, IMatrixProducer<MatrixItem<T>>, IMatrixReader<MatrixItem<T>>, IMatrixWriter<MatrixItem<T>>, IChannel

Type Parameters

ParameterDefaultDescription
Tany

Methods

MethodAlertsReturn TypeDescription
insertCols(colStart, count)BetavoidInserts columns into the matrix.
insertRows(rowStart, count)BetavoidInserts rows into the matrix.
isSetCellConflictResolutionPolicyFWW()BetabooleanWhether the current conflict resolution policy is first-write win (FWW). See switchSetCellPolicy() for more details.
openUndo(consumer)BetavoidAttach an IUndoConsumer to the matrix.
removeCols(colStart, count)BetavoidRemoves columns from the matrix.
removeRows(rowStart, count)BetavoidRemoves rows from the matrix.
setCells(rowStart, colStart, colCount, values)BetavoidSets a range of cells in the matrix. Cells are set in consecutive columns between colStart and colStart + colCount - 1. When values has larger size than colCount, the extra values are inserted in subsequent rows a la text-wrapping.
switchSetCellPolicy()Betavoid

Change the conflict resolution policy for setCell operations to first-write win (FWW).

This API only switches from LWW to FWW and not from FWW to LWW.

Method Details

insertCols

Inserts columns into the matrix.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

insertCols(colStart: number, count: number): void;

Remarks

Inserting 0 columns is a noop.

Parameters

ParameterTypeDescription
colStartnumberIndex of the first column to insert.
countnumberNumber of columns to insert.

insertRows

Inserts rows into the matrix.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

insertRows(rowStart: number, count: number): void;

Remarks

Inserting 0 rows is a noop.

Parameters

ParameterTypeDescription
rowStartnumberIndex of the first row to insert.
countnumberNumber of rows to insert.

isSetCellConflictResolutionPolicyFWW

Whether the current conflict resolution policy is first-write win (FWW). See switchSetCellPolicy() for more details.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

isSetCellConflictResolutionPolicyFWW(): boolean;

Returns

Return type: boolean

openUndo

Attach an IUndoConsumer to the matrix.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

openUndo(consumer: IUndoConsumer): void;

Parameters

ParameterTypeDescription
consumerIUndoConsumerUndo consumer which will receive revertibles from the matrix.

removeCols

Removes columns from the matrix.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

removeCols(colStart: number, count: number): void;

Remarks

Removing 0 columns is a noop.

Parameters

ParameterTypeDescription
colStartnumberIndex of the first column to remove.
countnumberNumber of columns to remove.

removeRows

Removes rows from the matrix.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

removeRows(rowStart: number, count: number): void;

Remarks

Removing 0 rows is a noop.

Parameters

ParameterTypeDescription
rowStartnumberIndex of the first row to remove.
countnumberNumber of rows to remove.

setCells

Sets a range of cells in the matrix. Cells are set in consecutive columns between colStart and colStart + colCount - 1. When values has larger size than colCount, the extra values are inserted in subsequent rows a la text-wrapping.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

setCells(rowStart: number, colStart: number, colCount: number, values: readonly MatrixItem<T>[]): void;

Remarks

This is not currently more efficient than calling setCell for each cell.

Parameters

ParameterTypeDescription
rowStartnumberIndex of the row to start setting cells.
colStartnumberIndex of the column to start setting cells.
colCountnumberNumber of columns to set before wrapping to subsequent rows (if values has more items)
valuesreadonly MatrixItem<T>[]Values to insert.

switchSetCellPolicy

Change the conflict resolution policy for setCell operations to first-write win (FWW).

This API only switches from LWW to FWW and not from FWW to LWW.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

switchSetCellPolicy(): void;