Hello :wave: I have a few questions about custom d...
# gooddata-ui
m
Hello 👋 I have a few questions about custom dashboard plugins. Do custom widgets support these filters? Alternatively, how do I set them up for local development? Do these filters work in the InsightView in the custom component, or if not, how to make the filters work? Thanks for the help!
j
Ahoj Marku, in the screenshot I can see the ability to exclude certain filters from being applied to a particular insight on a dashboard. Yes, this is fully supported in Dashboard Plugins and you can read more about it at https://sdk.gooddata.com/gooddata-ui/docs/dashboard_plugins_api.html#calculate-data-for-a-custom-widget.
Filters work across majority of GoodData.UI visualization components, such as <InsightView />, <Headline />, <ColumnChart />, <PivotTable />, or <Execute />.
If you tell us what exactly you are trying to achieve we might be able to provide more specific advice. Let us know if it helped!
m
@Jiri Zajic Ahoj Jirko, I’m trying to make KPI + Chart in one component. We’re trying to get a better display so it works like a single tile. The problem is that the dashboard filter doesn’t seem to work when I use
withCustomDecorator
function. Do I need to use the
useCustomWidgetExecutionDataView()
and
useCustomWidgetInsightDataView()
hooks somehow, or how to make it work? Thanks!
j
If you are trying to render a custom insight, then you want to use
useCustomWidgetExecutionDataView()
or
useCustomWidgetInsightDataView()
to get the raw data. If both insights are GoodData.UI components, you can get dashboard filters using
useDashboardSelector(selectFilterContextFilters)
and pass them to the component via
filters
prop like this
<ChartComponent filters={[ … ]} />
. Does that help? 🙄
Or, there is also
useWidgetFilters()
that respects dashboard filters, ignored widget filters etc. Also an option for you 🙂