> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# DashboardStoreAccessorRepository

- Package: [@gooddata/sdk-ui-dashboard](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/index.md)
- Kind: class
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-ui-dashboard/src/model/store/storeAccessors/DashboardStoreAccessorRepository.ts

This singleton class serves the selector and the dispatcher properties for given dashboard.

**Signature:**

```typescript
export declare class DashboardStoreAccessorRepository 
```

## Remarks

The [Dashboard()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboard/index.md) component has an optional property  through which you can handle setting of the values for [DashboardDispatch](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboarddispatch/index.md) and [DashboardSelectorEvaluator](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardselectorevaluator/index.md).

In your component using [Dashboard()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboard/index.md) you can create an onStateChange callback for your dashboard using  and pass it to mentioned Dashboard component property.

## Example

```tsx
 const dashboardStoreAccessors = DashboardStoreAccessorRepository.getInstance();

 // in the code where needed
 dashboardStoreAccessors.getAccessorsForDashboard(<DASHBOARD_ID>).getDispatch()(
     changeDateFilterSelection("relative", "GDC.time.month", "-3", "0"),
 );

 // or with check if accessor is initialized already
 if (dashboardStoreAccessors.isAccessorInitializedForDashboard(DASHBOARD_ID)) {
         setSelectResult(
             dashboardStoreAccessors.getAccessorsForDashboard(DASHBOARD_ID).getSelector()(
                 selectEffectiveDateFilterOptions,
             ),
         );
     }

 return (
     <Dashboard dashboard={"<dashboardId>"} onStateChange={dashboardStoreAccessors.getOnChangeHandlerForDashboard(DASHBOARD_REF)}/>
 )
```
To get latest properties, use static member function . If there is already an instance created, it will return this instance and will return new instance of the [DashboardStoreAccessor](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardstoreaccessor/index.md) otherwise.

## Methods

| Method | Modifiers | Description |
| --- | --- | --- |
| [clearAccessorForDashboard(dashboard)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardstoreaccessorrepository/index.md#dashboardstoreaccessorrepositoryclearaccessorfordashboard) | `static` | Removes dashboard accessors from for the given dashboard [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md). |
| [clearAllAccessors()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardstoreaccessorrepository/index.md#dashboardstoreaccessorrepositoryclearallaccessors) | `static` | Clears all accessors saved in accessors map. |
| [getAccessorsForDashboard(dashboard)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardstoreaccessorrepository/index.md#dashboardstoreaccessorrepositorygetaccessorsfordashboard) | `static` | Gets the correct [DashboardStoreAccessor](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardstoreaccessor/index.md) for given dashboard from the accessors map. |
| [getDashboardDispatchForDashboard(dashboard)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardstoreaccessorrepository/index.md#dashboardstoreaccessorrepositorygetdashboarddispatchfordashboard) | `static` | Gets the correct [DashboardDispatch](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboarddispatch/index.md) for given dashboard from the accessors map. |
| [getDashboardSelectForDashboard(dashboard)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardstoreaccessorrepository/index.md#dashboardstoreaccessorrepositorygetdashboardselectfordashboard) | `static` | Gets the correct [DashboardSelectorEvaluator](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardselectorevaluator/index.md) for given dashboard from the accessors map. |
| [getOnChangeHandlerForDashboard(dashboard)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardstoreaccessorrepository/index.md#dashboardstoreaccessorrepositorygetonchangehandlerfordashboard) | `static` | Creates a callback for given dashboard. |
| [isAccessorInitializedForDashboard(dashboard)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardstoreaccessorrepository/index.md#dashboardstoreaccessorrepositoryisaccessorinitializedfordashboard) | `static` | Checks if accessors is initialized for given dashboard [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md). |

## Method details

### DashboardStoreAccessorRepository.clearAccessorForDashboard()

Removes dashboard accessors from  for the given dashboard [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md).

**Signature:**

```typescript
static clearAccessorForDashboard(dashboard: ObjRef | string): void;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| dashboard | [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) \| string | an [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) of the dashboard, or its id as a string |

**Returns:**

void

### DashboardStoreAccessorRepository.clearAllAccessors()

Clears all accessors saved in accessors map.

**Signature:**

```typescript
static clearAllAccessors(): void;
```
**Returns:**

void

### DashboardStoreAccessorRepository.getAccessorsForDashboard()

Gets the correct [DashboardStoreAccessor](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardstoreaccessor/index.md) for given dashboard from the accessors map.

**Signature:**

```typescript
static getAccessorsForDashboard(dashboard: ObjRef | string): DashboardStoreAccessor;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| dashboard | [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) \| string | an [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) of the dashboard, or its id as a string |

**Returns:**

[DashboardStoreAccessor](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardstoreaccessor/index.md)

### DashboardStoreAccessorRepository.getDashboardDispatchForDashboard()

Gets the correct [DashboardDispatch](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboarddispatch/index.md) for given dashboard from the accessors map.

**Signature:**

```typescript
static getDashboardDispatchForDashboard(dashboard: ObjRef | string): DashboardDispatch;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| dashboard | [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) \| string | an [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) of the dashboard, or its id as a string |

**Returns:**

[DashboardDispatch](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboarddispatch/index.md)

### DashboardStoreAccessorRepository.getDashboardSelectForDashboard()

Gets the correct [DashboardSelectorEvaluator](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardselectorevaluator/index.md) for given dashboard from the accessors map.

**Signature:**

```typescript
static getDashboardSelectForDashboard(dashboard: ObjRef | string): DashboardSelectorEvaluator;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| dashboard | [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) \| string | an [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) of the dashboard, or its id as a string |

**Returns:**

[DashboardSelectorEvaluator](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardselectorevaluator/index.md)

### DashboardStoreAccessorRepository.getOnChangeHandlerForDashboard()

Creates a  callback for given dashboard.

**Signature:**

```typescript
static getOnChangeHandlerForDashboard(dashboard: ObjRef | string): (state: DashboardState, dispatch: DashboardDispatch) => void;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| dashboard | [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) \| string | an [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) of the dashboard, or its id as a string |

**Returns:**

(state: [DashboardState](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboardstate/index.md), dispatch: [DashboardDispatch](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.dashboarddispatch/index.md)) =&gt; void

### DashboardStoreAccessorRepository.isAccessorInitializedForDashboard()

Checks if accessors is initialized for given dashboard [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md).

**Signature:**

```typescript
static isAccessorInitializedForDashboard(dashboard: ObjRef | string): boolean;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| dashboard | [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) \| string | an [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) of the dashboard, or its id as a string |

**Returns:**

boolean
