Home > @activeviam/activeui-sdk > SelectedPageAware
SelectedPageAware() function
A Function As Child Component that provides the API and index of the active page of the currently selected dashboard.
Signature:
export declare function SelectedPageAware(props: SelectedPageAwareProps): JSX.Element;
Parameters
Parameter | Type | Description |
---|---|---|
props | SelectedPageAwareProps |
Returns:
JSX.Element
Example
// Custom button to add an unconfigured Pivot Table to the active page of the selected dashboard
// The bookmark content should be adapted. This is just an example.
const unconfiguredPivotTableBookmark = {
type: 'container',
value: {
body: {
tabular: {
hideAddButton: true,
lineNumbers: true,
statisticsShown: true,
},
},
containerKey: 'pivot-table',
showTitleBar: true,
},
};
const AddPivotTableButton = () => (
<SelectedPageAware>
{selectedPageApi => (
<Button
onClick={() => {
selectedPageApi
.loadBookmarkRelativeTo(unconfiguredPivotTableBookmark, 0, 'right');
}}
>
Add Pivot Table
</Button>
)}
</SelectedPageAware>
);