Yang-Tang / shinyjqui

jQuery UI Interactions and Effects for Shiny
https://yang-tang.github.io/shinyjqui/
Other
271 stars 32 forks source link

resizable and toggle does not work in 0.3.1 #28

Closed zetp closed 6 years ago

zetp commented 6 years ago

Hi, after update via CRAN from 0.3.0 to 0.3.1 functions jqui_resizable and jqui_toggle stopped working. There is no error in R console but you cannot resize element and toggle visibility.

The code below works with 0.3.0 but not with 0.3.1 [R version 3.5.0, shiny_1.1.0]

library(shiny)
library(shinyjqui)

# Define UI for application that draws a histogram
ui <- fluidPage(

   # Application title
   titlePanel("Old Faithful Geyser Data"),

   # Sidebar with a slider input for number of bins 
   sidebarLayout(
      sidebarPanel(
         sliderInput("bins",
                     "Number of bins:",
                     min = 1,
                     max = 50,
                     value = 30),
         actionButton(inputId = "toggle", label = "hide")
      ),

      # Show a plot of the generated distribution
      mainPanel(
        jqui_resizable(plotOutput("distPlot")),
        uiOutput("jqui")
      )
   )
)

# Define server logic required to draw a histogram
server <- function(input, output) {

   output$distPlot <- renderPlot({
      # generate bins based on input$bins from ui.R
      x    <- faithful[, 2] 
      bins <- seq(min(x), max(x), length.out = input$bins + 1)

      # draw the histogram with the specified number of bins
      hist(x, breaks = bins, col = 'darkgray', border = 'white')
   })

   output$jqui <- renderUI({
     ppp <- input$distPlot_size
     tags$small(paste0("current size: ",ppp$width, " x ", ppp$height))
   })

   observeEvent(input$toggle, {
     jqui_toggle("#bins", effect=NULL) 
   })
}

# Run the application 
shinyApp(ui = ui, server = server)
Yang-Tang commented 6 years ago

Hi @zetp , thank you for the bug report. I pushed a fix to github about this. jqui_toggle should work now. Could you have a try to see whether it fixed your problem?

zetp commented 6 years ago

Github version works. Many Thanks!