embed-sdk
embed-sdk copied to clipboard
withFilters doesn't actually set initial filter values
const embedDashboard = await LookerEmbedSDK.createDashboardWithUrl(mySignedUrl)
.appendTo(embedContainer.current)
.withClassName('w-full', 'h-full')
.withFilters({ 'License Num': '12345' })
.withNext()
.build()
.connect();
I was poking around the source code a bit. It look like:
-
EmbedBuilder.withFilters
sets the passed in object to `this._params -
EmbedBuilder.build
is called, which returns anEmbedClient
object), -
EmbedClient.connect
internally callsthis.createIframe
(since I'm usingcreateDashboardWithUrl
), which sets up aChatty
instance. I feel like the_params
should be sent into theChatty
instance here but they are not?
Using version 1.6.0
On version 1.6.1
this issue is still present, filters are not updated
Hi @joeyorlando and @hitpopdimestop - I believe this is working as intended. The createDashboardWithUrl
method accepts a signed URL, and the target embed URL which is where the filters are specified is part of this signed value, so it can't be changed (as this would invalidate the signature)
Basically, unlike createDashboardWithId
, the use case for createDashboardWithUrl
is to let you provide a URL which could not be constructed using the out-of-the-box URL construction logic (where withFilters
is part of that standard URL construction)
I'd be curious to better understand your use case. For example, what kind of URL are you trying to pass in as the mySignedUrl value?
Also pinging anyone who gave this a thumbs up to possibly provide more context? @dnaport22 @fantua @charmingelle @rbob86
Hi @fabio-looker. If there is a limitation in using withfilters for createDashboardWithUrl then why there is nothing about it in docs? Also, there can be done next improvements:
- create a special
type
for the result ofcreateDashboardWithUrl
, which will not exposewithfilters
method - implement
withfilters
even forcreateDashboardWithUrl
, which will override filters from url
Hello,
Just wanted to mention that I'm using the createDashboardWithId
method and it appears to behave the same as @joeyorlando described in the original post. End Date Param
appears in the eventual db
object under _params
once the dashboard is fully loaded, however the filter is not applied.
const db = LookerEmbedSDK.createDashboardWithId(dashboardId)
.appendTo(el)
.withParams({
_theme: JSON.stringify({
show_filters_bar: false,
}),
})
.withNext() // Using Dashboard next
.withFilters(
{
'End Date Param': '2022/04/07',
}
)
.build()
.connect()
Using version 1.6.1
Chiming in here, we have:
console.log(filters)
LookerEmbedSDK.createDashboardWithId(this.getDashboardId())
.appendTo(this.el)
.withFilters(filters)
.withClassName('looker-dashboard-big')
.build()
.connect()
And the initial filters are not being set. If we do dashboard.updateFilters(same_exact_filters)
and then a run()
we can see the filters set, and then the dashboard updated.
Version 1.8.1
Hi @joeyorlando and @hitpopdimestop - I believe this is working as intended. The
createDashboardWithUrl
method accepts a signed URL, and the target embed URL which is where the filters are specified is part of this signed value, so it can't be changed (as this would invalidate the signature)Basically, unlike
createDashboardWithId
, the use case forcreateDashboardWithUrl
is to let you provide a URL which could not be constructed using the out-of-the-box URL construction logic (wherewithFilters
is part of that standard URL construction)I'd be curious to better understand your use case. For example, what kind of URL are you trying to pass in as the mySignedUrl value?
Thank you!