Embedding Examples

getState and setState API Demo

This page demonstrates the getState and setState methods from the Rill Iframe API. These methods allow you to programmatically control and monitor the state of an embedded Rill dashboard using the postMessage API.Try the interactive controls below to see these methods in action!

Loading...

setState(state) Method

Sets the current state inside the iframe. You can use this to programmatically change views, apply filters, or modify the dashboard configuration.

iframe.contentWindow.postMessage({ id: 1, method: "setState", params: "view=pivot&tr=PT24H&grain=hour", }, "*");

Response: { "id": 1, "result": true }

Related Links: