DashboardStoreAccessorRepository
Home > @gooddata/sdk-ui-dashboard > DashboardStoreAccessorRepository
DashboardStoreAccessorRepository class
This singleton class serves the selector and the dispatcher properties for given dashboard.
Signature:
export declare class DashboardStoreAccessorRepository
Remarks
The component has an optional property through which you can handle setting of the values for DashboardDispatch and DashboardSelectorEvaluator.
In your component using you can create an onStateChange callback for your dashboard using and pass it to mentioned Dashboard component property.
Example
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 otherwise.
Methods
Method | Modifiers | Description |
---|---|---|
clearAccessorForDashboard(dashboard) | static | Removes dashboard accessors from for the given dashboard ObjRef. |
clearAllAccessors() | static | Clears all accessors saved in accessors map. |
getAccessorsForDashboard(dashboard) | static | Gets the correct DashboardStoreAccessor for given dashboard from the accessors map. |
getDashboardDispatchForDashboard(dashboard) | static | Gets the correct DashboardDispatch for given dashboard from the accessors map. |
getDashboardSelectForDashboard(dashboard) | static | Gets the correct DashboardSelectorEvaluator for given dashboard from the accessors map. |
getOnChangeHandlerForDashboard(dashboard) | static | Creates a callback for given dashboard. |
isAccessorInitializedForDashboard(dashboard) | static | Checks if accessors is initialized for given dashboard ObjRef. |