Hi Guys, I am trying to use the Dashboard Exporter...
# gooddata-ui
v
Hi Guys, I am trying to use the Dashboard Exporter using useDashboardPdfExporter. The filters that I pass along with the exportDashboard method are not applied and pdf is exported with all data. Is there any other example or work around?
d
Hi @Vatsal Trivedi Dan here from the GoodData.UI team. I just tried to use the hook in my test application and the filters ended up being applied properly. Can you please provide a code sample of how you are using the
useDashboardPdfExporter
? It might help me to better diagnose your problem. For reference, here is the sample code I used to test it:
Copy code
// (C) 2021 GoodData Corporation
import React from "react";
import { useDashboardPdfExporter } from "@gooddata/sdk-ui-ext";
import { idRef, newPositiveAttributeFilter, uriRef } from "@gooddata/sdk-model";

const filters = [
    newPositiveAttributeFilter(uriRef("/gdc/md/mbuumy476p78ybcceiru61hcyr8i8lo8/obj/2211"), {
        uris: ["/gdc/md/mbuumy476p78ybcceiru61hcyr8i8lo8/obj/2210/elements?id=6340112"],
    }),
];

export const Exporter = () => {
    const { status, exportDashboard } = useDashboardPdfExporter();

    return (
        <>
            Status: {status}
            <button type="button" onClick={() => exportDashboard(idRef("aaPscCUGaAGh"), filters)}>
                Export
            </button>
        </>
    );
};
1