Questions tagged [shinyjs]

shinyjs is an R package that lets you perform common useful JavaScript operations in Shiny applications without having to know any JavaScript. This is turn allows you to easily improve the user interaction and user experience in your Shiny apps. It can also be used to easily run your own custom JavaScript functions from R.

shinyjs lets you perform common useful JavaScript operations in Shiny apps that will greatly improve your apps without having to know any JavaScript.

Examples include: hiding an element, disabling an input, resetting an input back to its original value, delaying code execution by a few seconds, and many more useful functions for both the end user and the developer. shinyjs can also be used to easily call your own custom JavaScript functions from R.

Useful resources:

637 questions
6
votes
1 answer

Passing reactive data as choices for updateSelectizeInput

I am trying to pass reactive data to updateSelectizeInput but instead get the following error : Error in .getReactiveEnvironment()$currentContext() : Operation not allowed without an active reactive context. (You tried to do something that can…
R noob
  • 495
  • 3
  • 20
6
votes
1 answer

Remove the text in a shiny::textInput field on mouse click event

I have a simple textInput: textInput(inputId = "input1", h4("Name"), value = "Your name") How can I set an onclick event so that the text completely disappears when the user clicks on the text field? Is this possible via shinyjs::onclick?
wipuyotu
  • 63
  • 2
6
votes
1 answer

R Shiny - Automatically hide the sidebar when you navigate into tab items

I have a Shiny app - simplified example here - and I want the sidebar to hide dynamically when I navigate into tab items. Indeed users will connect to the app mainly with their mobile. With the help of the post Hide sidebar in default in…
Kumpelka
  • 869
  • 3
  • 11
  • 33
6
votes
0 answers

Why does content not appear in bsModal when coming from server?

For some reason the displaying of bsModal content seems to go wrong when it is triggered by an observeEvent from the server side, images and or text don't appear, and it also seems to cause a disabling of Sweetalerts in some cases (which are…
Mark
  • 2,789
  • 1
  • 26
  • 66
6
votes
1 answer

R shinyjs show/hide not working from module

I want to be able to switch various parts of my UI on/off using shinyjs show and hide. I need to access parts of the UI outside the module from within a module. Is this possible? See the attached app code. The show/hide buttons in the main server…
jxf
  • 163
  • 1
  • 9
6
votes
2 answers

How to run user input as R code in a Shiny app?

I want to create a shiny application that has an input for writing some R function or Command, reads it through the ui.R then passes it to the server.R that executes that R command to display the results. I spent hours searching about some example…
Programmer Man
  • 1,314
  • 1
  • 9
  • 29
6
votes
3 answers

clicking same plotly marker twice does not trigger events twice

I am using Plotly's event_data("plotly_click") to do stuff (opening a modal) after the user clicked on a marker in a scatter plot. Afterwards (e.g. closing the modal), event_data("plotly_click") does of course not change and clicking on the same…
shosaco
  • 5,915
  • 1
  • 30
  • 48
6
votes
2 answers

Disable button in shiny while plot is loading

Is it possible to disable a button in shiny while a plot / a reactive element is loading? I know shinyjs can disable and enable input elements, but I don't know how to set up the connection to a loading plot / reactive element. The example is based…
Felix Grossmann
  • 1,224
  • 1
  • 11
  • 30
6
votes
1 answer

show(), hide() usage from shinyjs, Shiny

I have a simplified version of a shiny application I developed. What I want is to be able to show dataframe1 when Frame1 actionbutton is pressed and hide dataframe2 and again show dataframe2 when Frame2 actionbutton is pressed and hide dataframe1. I…
Alperen Taciroglu
  • 351
  • 1
  • 5
  • 15
6
votes
3 answers

activate tabpanel from another tabpanel

I want when i start the application the tab panel tab2 = desactivated, and will be activated once i click the button in the first tab panel tab1, i tried with shinyjs and through CSS properties but i can not do that. thanks for your…
Hazem HASAN
  • 1,598
  • 2
  • 21
  • 38
5
votes
0 answers

including namespace in call to Javascript in Shiny module

I use in my shiny apps custom shinyInput functions that facilitate building dynamic tables such that users can provide input from checkboxes, drop downs, text boxes, etc. to each row of a table. This functionality relies on calling Javascript in the…
srearl
  • 51
  • 2
5
votes
2 answers

Trigger observeEvent in Shiny even when condition hasn't changed

I am having some trouble getting the functionality in my app that I'm looking for because of the way observeEvent works (which is normally very intuitive). The basic functionality I'm looking for is that a user can input a couple numbers, click…
phalteman
  • 3,442
  • 1
  • 29
  • 46
5
votes
2 answers

Access Javascript Variable in R Shiny Application

I want to know if it is possible to use variables created in runjs() in my R code. For example will I be able to access the variable today_var outside the runjs() function for further analysis. if (interactive()) { library(shiny) shinyApp( …
kay_arr
  • 53
  • 4
5
votes
1 answer

Resetting fileInput in Shiny App

I have been trying for a long time to reset fileInput in a Shiny app and read solutions to similar problems, but my problem still persists. Most solutions ultimately lead to using Dean Attali's brilliant shinyjs package and the reset() function…
Dhiraj
  • 1,650
  • 1
  • 18
  • 44
5
votes
0 answers

Javascript not retrieving cookie from browser in R shiny app

I'm attempting to retrieve a cookie from a user's browser in a shiny app to produce a different UI for different users. To work with cookie sin R shiny, I've followed this tutorial and I've extended shinyjs with the following javascript…
J0HN_TIT0R
  • 323
  • 1
  • 13
1 2
3
42 43