I have a shiny app that uses knobInputs from shinywidgets. I need to change some of the parameters dynamically in the server. I know how to change the value of a knob using updateKnobInput, but I don't understand how to change the other parameters. Specifically, I need to set readOnly from FALSE to TRUE, when a certain thing is clicked by the user.
In the documentation of updateKnobInput it states: "options List of additional parameters to update, use knobInput's arguments." Unfortunately, I do not understand how to actually code this
Please see my example. When the user clicks the button, the knob's value should change from 50 to 15 (that works) and the knobs readOnly should change from FALSE to TRUE (that does not work).
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
knobInput("myknob", label = "My Knob", min = 0, max = 100, value = 50, readOnly = F),
actionButton("changeknob", label = "Change the knob")
)
server <- function(input, output, session) {
observeEvent(input$changeknob, {
updateKnobInput(session, "myknob", value = 15, options = list(readOnly = T))
})
}
shinyApp(ui = ui, server = server)
Thank you very much for your help!