-
Notifications
You must be signed in to change notification settings - Fork 206
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
Widget list #110
Widget list #110
Conversation
This is excellent! I will wait until after CRAN release to take it though as it touches enough code to warrant some field testing. |
@jjallaire Is there a chance this PR can be merged? I'm asking because I just saw this issue yet another time: http://stackoverflow.com/q/35193612/559676 |
@yihui I can test this over the weekend and merge it in. If @jjallaire or @jcheng5 can get to it before, then that's fine as well. I think the only piece of code that will touch existing widgets is the refactoring out the viewer function. So, this should be pretty quick. |
You are right. Everything else is new and should be fairly safe except the refactoring of the viewer function. |
This particular issue has been bothering me for quite some time. Good to see someone is working on it guys. Please let us know when it is fixed and what exactly we should update for the fix to work. |
I don't think this is needed--you can just use |
|
Oh, my example doesn't work at the console unless you also wrap the tagList with |
Darn it. What was I thinking about?... |
Clearly not that obvious if you keep getting asked about it by users... 😐 |
Just use htmltools::tagList()! This reverts commit 7ba4253.
It's now working for me and the interactive plots are functioning in the browser. There are, however, two issues,s till. First, to make it work I have to manually add the javascript source location at the top of the HTML document, because it doesn't to it for me automatically. So I have to copy-paste something like Second, the x-axis label of my plots is gone. Any chance someone has a solution, or a tip where to look for a solution? As you may imagine, I m a beginner with both markdown and HTML (but have adequate experience with R) |
You shouldn't have to do any of that. Can you share your code here so that we can try to reproduce and diagnose the source of the problem. |
I also ran across this issue today and am glad to have found the |
Hi, Is there a way to add
Before, I was successfully doing something like this with nested for-loops, but once I tried using figures with HTML dependencies, such as A follow up question I have is: suppose I wanted to nest these tabs into another set of tabs created the same way, is that possible? What I mean to ask is, can I nest tabs dynamically using a method like this, analogous to a nested for-loop? I am still learning how to use knitr, and would appreciate any help! |
Good question, and I think others will be helped by this discussion. It might be easiest to start by building something like what you propose from scratch without the aid of manually build
in rmarkdownThere is probably a better way to make this work, but until someone sets me straight, we can take the approach from above and use it in
|
@yihui Hi! I am facing the same problem as you mentioned in this example: printing a series of data tables which created from a loop in R markdown. I am wondering if it is the problem of the package version. So I also tried to download htmlwidgets from CRAN and "install_github('ramnathv/htmlwidgets')". Unfortunately, I still didn't get the tables and map in R markdown. Could you please help me with it? |
I have been asked multiple times how to render widgets in a loop in R Markdown (e.g. rstudio/DT#67). We cannot just do
for (i in 1:n) print(widget[i])
(evenknit_print(widget[i])
won't work), because the metadata about HTML dependencies is not recorded. The metadata is stored only when a top-level R expression that renders a widget is printed. This PR brings a top-level objectwidgetList()
, and all its widget elements will be rendered (with their metadata correctly recorded).Note this PR requires knitr >= 1.10.9.
rstudio/htmltools#29 will enhance this PR, but it is not essential.I'm totally fine if this PR is accepted after htmlwidgets 0.4 is released to CRAN.
An example (works in both R console and R Markdown):