microsoft / datamations

https://microsoft.github.io/datamations/
Other
66 stars 14 forks source link

Can't have multiple datamations widgets on the same page #133

Closed sharlagelfand closed 2 years ago

sharlagelfand commented 2 years ago

Looks like the way datamations widgets are created / controlled is not actually independent, making it not possible right now to properly have multiple on one page (e.g. to show multiple examples). Will demo in our meeting.

sharlagelfand commented 2 years ago

@giorgi-ghviniashvili here is the HTML file with multiple widgets for debugging - thank you!

giorgi-ghviniashvili commented 2 years ago

hi @sharlagelfand , that's definitely because window.app is used everywhere:

image

Instead, it should be either window.app1, window.app2 or list of apps: [app1, app2, app3] and then access it as window.apps[index].. Can you make that list?

sharlagelfand commented 2 years ago

@giorgi-ghviniashvili each app is created independently here so I'm not able to make a list of apps - I will try to used the element ID to make each app unique though (e.g. window.htmlwidget-5a23eaf6aa3b92eb698b or something). Thanks!

sharlagelfand commented 2 years ago

Solved by making each app name unique with the ID (e.g. window.apphtmlwidget5a23eaf6aa3b92eb698b) - all good!