# Data Manager–Based Model

## Content

The Data Manager–Based Collaboration Model defines how table state managed by the SpreadJS DataManager participates in real-time collaboration.
The DataManager is a front-end data modeling and transport layer. It allows applications to:

* Define tables
* Configure data sources
* Establish relationships between tables
* Define views
* Coordinate local or remote data operations

The DataManager manages structured table state. It does not provide user interaction directly.

## Supported Feature Areas

The Data Manager-Based Collaboration Model currently applies to the following feature areas:

* **TableSheet** — A worksheet-type component bound to a DataManager table view.
* **DataManager-based binding** — Binding scenarios where the binding source is a DataManager table.

For TableSheet behavior, see [TableSheet Collaboration](/spreadjs/docs/spreadjs-collaboration-server/spreadjs-sheets-collaboration/collaboration-capability/data-manager-based-model/tablesheet).
For DataManager-based binding behavior, see [DataManager-Based Binding](/spreadjs/docs/spreadjs-collaboration-server/spreadjs-sheets-collaboration/collaboration-capability/data-manager-based-model/datamanager-based-binding).

## Collaboration Boundary

Collaboration synchronizes only state that is:

* Persisted within the DataManager runtime
* Serializable
* Deterministically replayable across clients

State delegated to external systems is not synchronized.

## Synchronized State

### 1\. Table Structure and Configuration

The following table-level state is synchronized:

* Table definitions
* Column definitions and metadata
* View definitions
* Relationships
* Hierarchy configuration
* Table options and layout configuration
* Serializable data source configuration

Any modification to the above structural state participates in collaboration.

### 2\. Dataset State \(Local Data Only\)

Dataset mutations are synchronized only when the table uses the `data` option with JSON-based in-memory data.
Supported format:

* `data` (JSON objects)

When using this mode, the following dataset mutations participate in collaboration:

* Record value updates
* Record insertion and removal
* Column structural changes
* Hierarchy structural adjustments
* Row pin and unpin state

In this mode, dataset state is fully managed by the DataManager and included in collaboration snapshots.

## Not Synchronized

The following scenarios do not participate in **dataset synchronization**:

### Remote Data Source (URL-Based)

When using `dataSourceOption.remote `with URL-based transport options (including `autoSync: true`):

* Table editing is supported.
* DataManager sends changes to the remote service.
* Dataset mutations are not synchronized by the collaboration system.

Data consistency is delegated to the backend service.
Configuration state remains synchronized if it is serializable.

### Remote Data Source (Function Handlers)

When using function-based handlers such as:

```typescript
GC.Data.RemoteReadHandler
GC.Data.RemoteChangeHandler
```

* The configuration cannot be serialized.
* The table does not participate in collaboration.

### CSV or XML Data

When dataset content is initialized from CSV or XML formats:

* Configuration state is synchronized.
* Dataset mutations are not synchronized.

## Special Rules

### No Presence Awareness

Presence indicators (such as selections or cursors) are not supported under this model.

### Undo Behavior

Undo is supported for synchronized state.

>type=note
> To maintain consistency, the local undo stack is cleared when remote operations are received.

### Fragment Storage

Large dataset state may be stored separately using fragments to optimize snapshot size.