Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Dashboard actions and filters

Refresh the dashboard, go fullscreen, open a side drawer, change the layer and read filters from a Custom Metric widget — useUbidotsActions, useUbidotsSelectedFilters

GET

  • Selected filters: useUbidotsSelectedFilters() returns FilterValue[] | null.

  • The dashboard object: useUbidotsDashboardObject() returns DashboardObject | null.

EMIT (useUbidotsActions())

Action
Call

Refresh the dashboard

refreshDashboard()

Fullscreen

setFullScreen('toggle' | 'enable' | 'disable')

Open a side drawer

openDrawer({ url, width }), with width in px

Change the layer

setDashboardLayer(layerId)

How to implement: a small toolbar

import { useUbidotsActions } from '@ubidots/react-html-canvas';

function Toolbar() {
  const { refreshDashboard, setFullScreen, openDrawer } = useUbidotsActions();
  return (
    <div>
      <button onClick={() => refreshDashboard()}>Refresh</button>
      <button onClick={() => setFullScreen('toggle')}>Fullscreen</button>
      <button onClick={() => openDrawer({ url: 'https://example.com/details', width: 420 })}>
        Details
      </button>
    </div>
  );
}

Last updated

Was this helpful?