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

Parameter Default Description
T any

Methods

Method Alerts Return Type Description
insertCols(colStart, count) Alpha void Inserts columns into the matrix.
insertRows(rowStart, count) Alpha void Inserts rows into the matrix.
isSetCellConflictResolutionPolicyFWW() Alpha boolean Whether the current conflict resolution policy is first-write win (FWW). See switchSetCellPolicy() for more details.
openUndo(consumer) Alpha void Attach an IUndoConsumer to the matrix.
removeCols(colStart, count) Alpha void Removes columns from the matrix.
removeRows(rowStart, count) Alpha void Removes rows from the matrix.
setCells(rowStart, colStart, colCount, values) Alpha void 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.
switchSetCellPolicy() Alpha void

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

Parameter Type Description
colStart number Index of the first column to insert.
count number Number 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

Parameter Type Description
rowStart number Index of the first row to insert.
count number Number 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

Parameter Type Description
consumer IUndoConsumer Undo 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

Parameter Type Description
colStart number Index of the first column to remove.
count number Number 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

Parameter Type Description
rowStart number Index of the first row to remove.
count number Number 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

Parameter Type Description
rowStart number Index of the row to start setting cells.
colStart number Index of the column to start setting cells.
colCount number Number of columns to set before wrapping to subsequent rows (if values has more items)
values readonly 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;