# setState

Restores complete or selected state slices and returns applied/issue reports. Only slices in appliedSlices were actually applied.

Canonical: https://grid.syidax.com/docs/methods/setState/

<a id="meaning"></a>

## What does this API do?

Restores complete or selected state slices and returns applied/issue reports. Only slices in appliedSlices were actually applied.

<a id="contract"></a>

## Exact input and result types

```typescript
setState(state: SyGridState, options?: GridStateApplyOptions): Promise<SyGridStateApplyReport>
```

| Arguments | Required | Type |
| --- | --- | --- |
| state | Required | SyGridState |
| options | Optional | GridStateApplyOptions |

The return type is `Promise<SyGridStateApplyReport>`.

<a id="usage"></a>

## Usage flow

After registering and initializing the Grid element, call grid.setState(…). Read the return value with await. For methods returning a boolean or report, inspect the result before continuing.

<a id="types"></a>

## Read related types

- [SyGridState](https://grid.syidax.com/docs/types/SyGridState.md)
- [GridStateApplyOptions](https://grid.syidax.com/docs/types/GridStateApplyOptions.md)
- [SyGridStateApplyReport](https://grid.syidax.com/docs/types/SyGridStateApplyReport.md)

<a id="recipes"></a>

## Feature explanations and examples

- [Settings and data fundamentals](https://grid.syidax.com/docs/guides/concepts.md)
- [API calls and event integration](https://grid.syidax.com/docs/guides/data-event-access.md)
