R shiny updateCheckboxInput -
i have r shiny application in have drop down box defined in ui.r
lib
values c("x","y","z") , check box called spcheck
defined
checkboxinput("spcheck","label1",value = false))
other conditions makes checkbox available when input$lib=z
, checking make few things appear. when users select different library, x, want make spcheck
value false
, added following code server.r
observe({ if (input$lib %in% c("x","y") ) {cat("uncheck called 1 : ",input$spcheck,'\n') updatecheckboxinput(session,"spcheck","label1,value = false) cat("uncheck called 2 : ",input$spcheck,'\n') } else return() })
the text displayed @ console :
uncheck called 1 : true uncheck called 2 : true
why not making spcheck value false? may i'm missing trivial, couldn't figure out. help??
because takes few milliseconds since tell shiny update input until happens. when call update method, shiny has send message javascript change value of input, , once that's done, javascript sends message r saying input has new value. input
variable not change instantly when make call, it'll have updated value next time reactive statement uses input$spcheck
variable
Comments
Post a Comment