IPlaceholder
Home > @gooddata/sdk-ui > IPlaceholder
IPlaceholder type
Placeholder represents a reference to a specific part of the execution - attribute(s), measure(s), filter(s), sort(s) or total(s), that may change the value at runtime.
Signature:
export declare type IPlaceholder<T> = {
type: "IPlaceholder";
id: string;
defaultValue?: T;
value?: T;
validate?: (value: T) => void;
use: IUsePlaceholderHook<IPlaceholder<T>>;
};
References: IUsePlaceholderHook, IPlaceholder
Remarks
You can provide it to visualizations instead of the attributes/measures/filters/sorts/totals themselves, placeholders will be replaced with the actual values on the background.
This allows you: - share a reference to the same execution elements across multiple components. - change the value of these execution elements with ease. - decouple hardcoded execution elements from the visualizations. - update any number of visualizations just by updating the placeholder value.
Placeholder values are living in React context and you can obtain/set their values by the following hooks: - usePlaceholder()
Note: - Don't create placeholders manually, to create a new placeholder, use factory function newPlaceholder(). - To make it work, don't forget to wrap your application in PlaceholdersProvider().