Merwane Hamadi
04/05/2023, 7:42 PMJoseph Heun
04/05/2023, 7:56 PMMerwane Hamadi
04/05/2023, 7:58 PMMerwane Hamadi
04/05/2023, 8:05 PMTomas Muchka
04/06/2023, 7:34 AMdocument.getElementById(IFRAME_ID).contentWindow.postMessage(
{
gdc: {
product: "dashboard",
event: {
name: "setFilterContext",
data: {
filters: [newFilter]
}
}
}
},
backend
);
Check the following article for more details: https://community.gooddata.com/sdks-and-apis-kb-articles-52/embedding-dashboards-into-your-application-206
Note: Dashboard component in GoodData.UI allows to set the filter context as well: https://sdk.gooddata.com/gooddata-ui/docs/dashboard_component.html#base-propsMerwane Hamadi
04/06/2023, 12:43 PMMerwane Hamadi
04/06/2023, 12:45 PMTomas Muchka
04/06/2023, 1:02 PMMerwane Hamadi
04/10/2023, 5:00 PM@extends('app')
@section('content')
<form id="helperForm" target="embeddedGoodDataIframe" method="post" action="{{ $customerLoginUrl }}">
<input id="targetUrl" type="hidden" name="targetUrl" value="{{ $targetUrl }}"/>
<input id="ssoProvider" type="hidden" name="ssoProvider" value="{{ $ssoProvider }}"/>
<input id="encryptedClaims" type="hidden" name="encryptedClaims" value=""/>
</form>
<iframe id="embeddedGoodDataIframe" style="height: calc(100vh - 125px);width:100%" name="embeddedGoodDataIframe" frameborder="0"></iframe>
@endsection
<script>
document.addEventListener('DOMContentLoaded', () => {
let pgpMessage = `{{ $encryptedClaims }}`;
document.getElementById('encryptedClaims').value = pgpMessage;
document.getElementById('helperForm').submit();
const newFilter = {
id: "yourAttributeOrMeasureIdentifier",
type: "attribute", // or "measure"
operator: "IN",
values: ["value1", "value2", "value3"]
};
const backendUrl = "*"; // Replace this with the actual backend URL
setFilter(newFilter, backendUrl);
});
function setFilter(newFilter, backend) {
const IFRAME_ID = "embeddedGoodDataIframe";
document.getElementById(IFRAME_ID).contentWindow.postMessage(
{
gdc: {
product: "dashboard",
event: {
name: "setFilterContext",
data: {
filters: [newFilter]
}
}
}
},
backend
);
}
</script>
Question:
• what's the backend supposed to be is it the targeturl ?
• as you can see I want to hardcode a filter just to try. but I can't find the id of this filter. I am in my dashboard and trying to find the place where the id is mentioned.Tomas Muchka
04/11/2023, 7:34 AMMerwane Hamadi
04/11/2023, 3:47 PMMerwane Hamadi
04/11/2023, 4:53 PMTomas Muchka
04/12/2023, 11:27 AM