Skip to content
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

Incompatible with shinyWidgets inputs #6

Open
DIPAD-Fran-Bryden opened this issue Apr 4, 2023 · 3 comments
Open

Incompatible with shinyWidgets inputs #6

DIPAD-Fran-Bryden opened this issue Apr 4, 2023 · 3 comments

Comments

@DIPAD-Fran-Bryden
Copy link

Hi, have found that your package works great with native Shiny inputs, but fails with inputs from the ShinyWidgets package.

Reprex:

library(shiny)
library(shinyWidgets)
library(shinyStorePlus)

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

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

    # Sidebar with a slider input for number of bins 
    sidebarLayout(
        sidebarPanel(
            radioButtons("bins",
                        "Number of bins:",
                        choices = c(1, 3, 5)),
            
            shinyWidgets::radioGroupButtons("bins1",
                                            "Number of bins",
                                            choices = c(1, 3, 5))
        ),

        # Show a plot of the generated distribution
        mainPanel(
           plotOutput("distPlot")
        )
    )
)

# 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 = as.numeric(input$bins) + 1)

        # draw the histogram with the specified number of bins
        hist(x, breaks = bins, col = 'darkgray', border = 'white')
    })
    
    #stores setup - save the values we gave it
    appid = "application31"
    setupStorage(appId = appid,inputs = TRUE)
    
}

# Run the application 
shinyApp(ui = ui, server = server)

In this example, the value passed to the regular radio buttons is saved but the one passed to the shinyWidgets buttons is lost.

@oobianom
Copy link
Owner

oobianom commented Apr 4, 2023

Will look into this and get back to you.

@oobianom
Copy link
Owner

oobianom commented Apr 4, 2023

I have made an update to the main branch that resolves this. You can test that out.
I will check other functionalities of shinyWidgets that may not be working out so well here, and try to resolve them as well.
Let me know if there are other inputs from that package that does not work with shinyStorePlus.
Once all is completed, I will submit for an update in CRAN.

@DIPAD-Fran-Bryden
Copy link
Author

Fabulous, can't believe how quickly you've done this! That's working perfectly for me now, the buttons work and the values are stored.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants