I have and simple example of the shiny app. Here I am testing the reaction of other elements to the change in the specific element.
ui.r
library(shiny)
shinyUI(fluidPage(
titlePanel("SCORE CARD DEVELOPMENT PLATFORM"),
navbarPage("ScoreDevApp",
tabPanel("Settings",
fluidRow(column(2,
actionButton("goButton_service", "Load saved parameters",width=200)
,radioButtons("DB_switch"
, "Select Data Source"
,c("Oracle"=1,"text file"=2)
)
)
)
),
tabPanel("Download & Binning input data",
fluidRow(column(2,
textInput("text","test")))),
id="ScoreDevApp"
)
)
)
server.r
library(shiny)
library(shinyjs)
shinyServer(function(input, output, session) {
observeEvent(input$goButton_service, {
updateRadioButtons(session
, "DB_switch"
, "Select Data Source"
,c("Oracle"=1,"text file"=2)
, selected = 2
, inline = FALSE
)
if(input$DB_switch==2){
updateTextInput(session,text,"test",value="testing")
}
})
})
Pressing the button 'goButton_service' causes the update of radiobutton 'DB_switch' -> selected item is 2 in place of 1 (on default). Thats is done well.
But then I am going to check the value of radiobutton: if it is 2 then the string "testing" should have been passed to the textInput 'text' on the tabpanel 'Download & Binning input data'. However it is not performed. Need a help with it.