Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can webR open a new html window (e.g. using the "reactable" library")? #248

Closed
SugarRayLua opened this issue Aug 11, 2023 · 6 comments
Closed
Labels
feature New feature or request

Comments

@SugarRayLua
Copy link

Hi.

Your team continues to do really amazing work with WebR. Now appears to be a very usable IDE!

I also saw that you've added a lot of packages which is very helpful. Specifically, I saw that you added reactable which I've been waiting for since with WebR one cannot open up an X window and thus one is unable to quickly use "View" to see one's dataframe in a convenient spreadsheet view. The reactable library provides some of the same functionality by allowing one to view one's dataframe as an html widget. Although reactable seemed to load up fine on webR, I couldn't get it to open and display a dataframe on my browser (Safari, mobile iOS on iPad).

Command given:
library(reactable)
reactable(mtcars)

No error or new html window with mtcars dataframe in it displayed.

Fyi.

@georgestagg georgestagg added the feature New feature or request label Aug 18, 2023
@georgestagg
Copy link
Member

Thanks for reporting this.

The underlying (more general) issue is that utils::browseURL() relies on system(), which is not available for webR.

In theory, the browseURL() function could be shimmed (similar to the suggestion in #262), but things might be made tricky by the fact that the HTML content only exists on the virtual filesystem. It will need some thought.

@SugarRayLua
Copy link
Author

Thank you for looking into this issue and considering a remedy. :-)

@timelyportfolio
Copy link

timelyportfolio commented Nov 19, 2023

Another potential (but inelegant) approach to htmlwidgets with webR would be to let R instantiate/construct the widget and then JS (with correct dependencies loaded) build through htmlwidgets.js. Here is an old post demonstrating the approach (long before webR). I'll try to build out a little example with reactable and webR.

@timelyportfolio
Copy link

Using a little easier approach than the post, here is an example how we might include reactable htmlwidget from webR. The most difficult part is manually handling/adding the dependencies. These should live in the webR virtual file system, so I am wondering if we could use/add from there. Also reminds me of ramnathv/htmlwidgets#249.

example on stackblitz

image

@georgestagg
Copy link
Member

Fixed in #449. Tracking browseURL() in #295.

@SugarRayLua
Copy link
Author

Thank you very much! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants