Use the setState method to set the state of the rendered Lightning web component for CRM Analytics dashboards.
Arguments
| Argument Name | Description |
|---|---|
state |
The state to update the CRM Analytics dashboard component with. |
Example
Add your implementation of the setState call into the wrapper Javascript and HTML for your component.
note: To use the communityDashboard component, replace wave-wave-dashboard-lwc with wave-community-dashboard.
The HTML for the component:
<template>
<lightning-button variant="brand" label="Set Dashboard State" title="Set State Action" onclick={setState} class="slds-m-left_x-small"></lightning-button>
<wave-wave-dashboard-lwc dashboard="0FK5B000000XiK14AK" height="1000"></wave-wave-dashboard-lwc>
</template>
The Javascript for the component, which implements setState():
import { LightningElement } from 'lwc';
export default class DashboardWrapper extends LightningElement {
_state = {};
setState () {
const dashboard = this.template.querySelector('wave-wave-dashboard-lwc');
dashboard.setState(this._state);
console.warn("setState complete");
}
}
The state can be set dynamically from user input or from another dashboard’s state. For the complete dashboard state structure, refer to the Analytics Dashboard JSON Reference guide.
See Also