embed-sdk
embed-sdk copied to clipboard
"hide_filter" property in withParams method on embed builder only hides one filter
Hello
I have have an embedded dashboard using createDashboardWithId
that has many filters, but I need to hide a few specific filters from the dashboard.
I am trying to hide the filters "Date selector" and "Date filter", code example below.
const options = {
hide_filter: "Date selector"
}
const db = LookerEmbedSDK.createDashboardWithId("123")
.withParams(options)
.withNext('')
.appendTo(el)
.build()
.connect()
.then((d) => {
setupDashboard(d);
})
I have tried
const options = {
hide_filter: "Date selector",
hide_filter: "Date filter"
}
Ends up only hiding "Date filter", because it does not allow repeat properties
const options = {
hide_filter: "Date selector,Date filter",
}
Does not work, results in showing both filters
const options = {
hide_filter: ["Date selector","Date filter"],
}
Obviously doesn't work because it expects a string.
Thanks for looking!
Link to hide_filter
docs https://cloud.google.com/looker/docs/filters-user-defined-dashboards#hiding_dashboard_filters
@nuwen - Did you ever figure this one out?
Hi @bryans99 , Can you please look into this issue and help with some workaround or solution? Is there any way to prioritise this bug? It would be great help.
Hello, this would be really helpful indeed.
And it should be doable as it's possible when embedding without the SDK. Do you think I could propose a PR @bryans99?
Hello, I opened PR #177 to fix it, I hope it will suit
PR #177 (released in @looker/[email protected]) fixes the signature of withParams
, and now we are allowed to pass a list of string:
.withParams({ hide_filter: ["filter_1", "filter_2"] })
but even with this change looker only hide one filter: the last one in the array.
Given how the parameters are stringified here
https://github.com/looker-open-source/embed-sdk/blob/23e6ab9650c5e3b045cfda57ad7e16def0b093ec/src/embed_builder.ts#L50
It seems to me the server can't handle querystring with repeated parameters ?hide_filter=filter1&hide_filter=filter2
.
@nuwen did you get a chance to test the new release of withParams
?
As @brunouber mentioned, this is still not usable cause the Looker back end does not handle the multiple parameters at all - or at least so it seems...
Wonder if anybody has a workaround for this or who to ping to get some feedback.. :-)