Forum Discussion

tarockx's avatar
tarockx
Frequent Visitor
2 years ago
Solved

Using the LocalStorage service inside a Dialog Box

Hello everyone   I'm developing a custom visual that makes use of Dialog Boxes, as documented here. The visual also uses the local storage API to read and write data to the local storage.   Now,...
  • dm-p's avatar
    2 years ago

    The dialog box API/host is essentially its own sandboxed iframe, separate from the visual in terms of how Power BI sees it. With this current implementation you can only pass simple objects between the visual and dialog box as a means of state management, as you have observed.

     

    Your post does not detail your use case, just that you need the feature, so I can't advise what would be a suitable workaround. However, taking a generalized approach, you would need to pass the portion of your local storage you need (hopefully serializable) to the dialog box as part of the options and then update your visual's local storage data with the returned changes when the event is handled in your visual.

     

    If this is not a suitable approach, you will need to request that MS add the feature to the dialog box host (via [email protected] or the Power BI Visuals API repo). To manage your expectations, you will need a very solid justification for any feature requests, so it's best to try and have everything ready to go in terms of having a case for this.

     

    Regards,

     

    Daniel