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
9
votes
1 answer

Disable action button when textinput is empty in Shiny app [R]

I'm building a shiny app in which a query from textInput is made when the user clicks on the "search" action button. I'd like that button to be disabled if the textInput box is empty. I'm using shinyjs::toggleState() here, but I can't figure out…
Phil
  • 7,287
  • 3
  • 36
  • 66
9
votes
1 answer

Shinydashboard grayed out downloadButton?

How can I fix the download button on this simple example? library(shiny) library(shinydashboard) library(shinyjs) header <- dashboardHeader() sidebar <- dashboardSidebar(shinyjs::useShinyjs(), …
Ignacio
  • 7,646
  • 16
  • 60
  • 113
8
votes
2 answers

How to hide a conditional panel in Shiny?

How to hide a conditional panel in Shiny? Please, see the following example: library(shiny) ui <- fluidPage( actionButton("eval","Evaluate"), numericInput("num_input", "If number is changed, cp must hide", value = 0), conditionalPanel( …
Joe
  • 1,628
  • 3
  • 25
  • 39
7
votes
0 answers

Wide datatables causing scrollx to scroll back when applying filters

I am able to render a datatable in my shiny app. However, whenever there is a wide table, the horizontal scroller gets back to it's initial position when you apply filters on the columns in the back. This issue occurs with numeric columns only. I…
AOE_player
  • 536
  • 2
  • 11
7
votes
0 answers

How to eliminate or async render blocking scripts in R shiny?

I have a simple app, using only a couple of packages library(shiny) library(tableHTML) library(shinyWidgets) library(shinyFeedback) library(lubridate) Overall it is fast once loaded, but on a new session window it takes 3-4s. When I analyse it on…
Arkadi w
  • 129
  • 22
7
votes
0 answers

Deploy R shiny app on LAN: Uncaught TypeError: Cannot read property 'readyState' of null

I've built a shiny web app that I would like to share with my colleagues. I use for that runApp(host = getOption("shiny.host", "10.161.112.8")) where 10.161.112.8 is my host server IP adress. The app works perfectly on my local server, but some…
JeanBertin
  • 633
  • 1
  • 7
  • 23
7
votes
2 answers

To enable and disable sidebar toggle button using a action button

I am looking for a code snippet using which, I can enable/disable sidebar toggle button in shinydashboard header. library(shiny) library(shinydashboard) library(shinyjs) ui <- shinyUI(dashboardPage( dashboardHeader(), dashboardSidebar(), …
kawsleo
  • 560
  • 4
  • 23
7
votes
1 answer

Shiny leaflet easyPrint plugin

I'm trying to incorporate the easyPrint plugin into my shiny leaflet app. What I want is something that looks like the demo, but in shiny. I have tried to mimic the examples, but have been unsuccessful. Here's my code for my R code so far: …
rfineman
  • 128
  • 2
  • 9
7
votes
2 answers

How to get coordinates from a R plotly figure

I have been struggling like mad to solve an apparently basic question. Imagine you have a scatter plot, with say ... 10 markers. I suppose this plot has been generated using plotly within a Shiny environment. One can easily get the coordinates of…
7
votes
1 answer

Restart shiny app from within app (reloading data)

I want to restart a shiny app from within the app, so that e.g. code in global.R will be executed again (to reload a csv file with data). Here is a minimal example showing what I want to do: This shiny app loads some coordinates data and plots…
needRhelp
  • 2,948
  • 2
  • 24
  • 48
7
votes
1 answer

Adding tooltip to disabled button in Shiny?

In R/Shiny, I would like to add a tooltip to inform the user that a button is disabled because mandatory fields aren't completed. I am able to get a tooltip to display using the ShinyBS package, however it does not seem to work when the button is…
Iain
  • 1,608
  • 4
  • 22
  • 27
7
votes
1 answer

Shiny: use shinyjs to fetch cookie data

I want to fetch cookie data from my Shiny app using shinyjs. I have created a cookie, "samplecookie=testval"; and I want to be able to retrieve the value of samplecookie. I use the below javascript function (where I pass the cookieName and it…
rookieJoe
  • 509
  • 6
  • 14
7
votes
3 answers

How to add/remove input fields dynamically by a button in shiny

I've been trying to find a solution how to add and remove input fields with a button in shiny. I don't have a source code since I haven't made that much progress, but this jQuery example…
samssan
  • 393
  • 3
  • 9
6
votes
1 answer

Shiny: set focus to input in modalDialog

I am trying to set focus to a textInput in a modalDialog in shiny. I am using shinyjs. Following guidance from the shinyjs documentation I came up with the following code which does not do what I expect: library(shiny) library(shinyjs) jscode <-…
Paul van Oppen
  • 1,443
  • 1
  • 9
  • 18
6
votes
1 answer

Freeze Header and Footer in Datatable - shiny

I want to freeze header and footer of the datatable in shiny app. I have researched and found this link https://datatables.net/examples/basic_init/scroll_xy.html . But when i include the script from above link, the datatable is not getting freezed.…
SJB
  • 662
  • 7
  • 15
1
2
3
42 43