\n
However, we cannot get our dashboard to apply our 2 filters at runtime.
\nWe've tried several variations on the urlParams but the result is always a loaded dashboard with no filters applied (users must manually set these filter values). Here is our code:
\ndashboardUiConfig: { \n hideTitle: true, \n hideTab: true, \n hideChartControls: true, \n filters: { \n visible: false, \n expanded: false\n },\n iframeTitle: false,\n urlParams: { level: 5, ou2: "Boston" }\n}\n
\nOur embedded result is always loaded with none of the above filters applied:
\n\nOur superset_config.py config file had the following lines added for embedding to work:
\nWTF_CSRF_ENABLED = False
\nSESSION_COOKIE_SAMESITE = None
\nTALISMAN_ENABLED = False
\nHoping this is something someone else has already encountered and figured out...
\nHaving inspected the page after rendering, the following URL is present (I would've expected the urlParams to be nested :?)
\n\n","author":{"@type":"Person","name":"Greg Rowles"},"upvoteCount":2,"answerCount":2,"acceptedAnswer":null}}Reputation: 341
We're using @superset-ui/embedded-sdk to embed a single dashboard with 2 preconfigured filters on an external site. We recently upgraded to the v4.0.1 (to take advantage of urlParams for dynamic filtering):
However, we cannot get our dashboard to apply our 2 filters at runtime.
We've tried several variations on the urlParams but the result is always a loaded dashboard with no filters applied (users must manually set these filter values). Here is our code:
dashboardUiConfig: {
hideTitle: true,
hideTab: true,
hideChartControls: true,
filters: {
visible: false,
expanded: false
},
iframeTitle: false,
urlParams: { level: 5, ou2: "Boston" }
}
Our embedded result is always loaded with none of the above filters applied:
Our superset_config.py config file had the following lines added for embedding to work:
WTF_CSRF_ENABLED = False
SESSION_COOKIE_SAMESITE = None
TALISMAN_ENABLED = False
Hoping this is something someone else has already encountered and figured out...
Having inspected the page after rendering, the following URL is present (I would've expected the urlParams to be nested :?)
Upvotes: 2
Views: 558
Reputation: 81
FEATURE_FLAGS = {
"ENABLE_TEMPLATE_PROCESSING": True,
}
urlParams: {
foo: 'bar',
}
select fld from tbl where fld= '{{ url_param('foo') }}'
Here's some useful documentation:
Also, you can add the following to your javascript to only set that url parameter if it is not none.
urlParams: {
{% if foo is not None %}
foo: '{{ foo }}',
{% endif %}
}
Then, in the sql for your data set, you can limit the results by that field only if that field was set.
select old from tbl where true
{% if url_param('foo') %}
and foo = '{{ url_param('foo') }}'
{% endif %}
Upvotes: 1
Reputation: 1
If you want to use urlParams you have to modify your query. It doesn't work with normal filters. Your query would have to be something like
SELECT * FROM example E WHERE E.level = '{{ url_param('level') }}' AND E.ou2='{{ url_param('ou2') }}
Upvotes: 0