Closed ghost closed 1 year ago
There's a discussion here https://github.com/rstudio/shiny/issues/3225 about using addResourcePath. Not using it would likely be problematic, for example https://github.com/daattali/addinslist/issues/117 happened because of trying to load local files. Perhaps it is causing issues, maybe htmlDependency would resolve those issues or maybe making the call in a .onLoad
would fix it - currently I don't know because I can't reproduce the problem.
I've been able to use colourpicker in other packages with no issue (for example https://github.com/daattali/shinyalert/blob/6dd2d2cb5b133f53dd0f935216742fef793f9b32/inst/examples/demo/ui.R) so I'm having trouble understranding the problem. It's possible you're seeing the same issue as #38 but I had to close it for lack of reproducibility. If you could post a reproducible example I'd be happy to look into this
@nickcrookston I might have fixed the issue now. I know it's been a long time but it would be great if you could try whatever you were trying before and let me know if this solved your problem. You shouldn't have to use addResourcePath anymore.
@nickcrookston confirmed via email that his code now works, this is fixed
Hello @daattali Thank you for your great package.
I think, that I encountered the same issue as above. I wrote a shiny app where the user can choose a color with colourpicker. It worked well. I then converted my code into a package and when I run the package, the input fields for color are displayed but there is no interactive color picker available. I inspected the html files of the shiny app and noticed that the app failed to load the javascript files necessary for the color picker (see screenshot below).
To help you to solve the issue, I created a simple fake package based on the default shiny app proposed by Rstudio (I just added a colourInput
field and use the field value as the color of the bars of the histogram):
https://github.com/emanuelhuber/testcolourpicker
In the readme I explain what I tested, namely:
colourpicker
does not workaddResourcePath(...)
according to the first comment of this discussion and then run the package: colourpicker
workscolourpicker
worksDo you have any idea, what could be the issue?
Best,
Emanuel
Are you using colourpicker's dev version from github?
I just tried installing your package from github and everything seems to work fine. But notice that this fix is very recent and not in CRAN yet.
Thank you for your impressive reactivity! No, I was using the CRAN version. Using the dev version from github works perfectly! Thank you for the advise!
Looks like this is related to issue 38.
We are moving to having our application be a formal "package" and in the package context, I start the shiny application with a function call that, in turn, calls shinyApp The app works but when I use this approach, I can't get the colourpicker objects to work (they are simply "text input boxes", as reported in 38. However, after debugging, and research, I discovered that if I add the following code, everything works!
addResourcePath("colourpicker-lib/js", system.file("www/shared/colourpicker/js", package="colourpicker")) addResourcePath("colourpicker-lib/css", system.file("www/shared/colourpicker/css",package="colourpicker")) addResourcePath("colourpicker-binding", system.file("srcjs",package="colourpicker"))
It seems to me that this should not be necessary and it worries me that if you change your package organization with respect to where you store some items (and it seems you do have options in this regard), then my code would break.
Can anyone suggest what I might be doing incorrectly that has created the need for the addResourcePath commands?