Select to view content in your preferred language

Writing data to a new tab from a custom widget

499
0
03-06-2023 09:37 AM
Labels (2)
clc
by
New Contributor III

Hi, I have a widget that generates data that I'd like the user to view in another tab (just like the Report widget in WebAppBuilder was doing). The data are: text, table and picture. Right now, I am using the following paradigm:

- Create a new tab by simply using window.open on a button click.

- Then create HTMLDivElement in the document of the new tab for each of the data type and configure the attributes of these elements.

- Finally append these elements to the document of the new tab.

It seems to work (see the test widget enclosed), but I am not sure it is the "right React" way to proceed. Before I have tried to implement createPortal from react-dom, but I could not make it work, that is why I reverted to this basic way.

Any insights would be great. Thanks.

Catherine

0 Kudos
0 Replies