问题描述
我正在努力解决基于模块中的代码更新用户界面中按钮的逻辑。当我单击按钮时,我希望它改变颜色,但没有任何反应。我理解为了在服务器模块中使用它而使 ui 输入具有反应性,但我不让它以相反的方式工作。非常感谢帮助(和一些解释)!
这是我的代码:(当我开始工作时,我将保存到 csv 部分留在了点击)。
library(shiny)
library(shinyBS)
module_company_ui<-function(id){
# `NS(id)` returns a namespace function,which was save as `ns` and will
# invoke later.
ns <- NS(id)
tagList(
radioButtons(ns("company_name"),label= "Is the << COMPANY NAME >> correct?",c("choose from below" = "10","correct" = "0.15","correct,but some noise" = "0.075","not sure" = "0.05","wrong" = "0"),selected = character(0)),textOutput(ns("txt")),bsButton(ns('save_inputs')," Save",type="action",block=TRUE,style="info",icon=icon(name="save"))
)
}
module_save_inputs<-function(id,value_company){
moduleServer(
id,## Below is the module function
function(input,output,session) {
save<-reactive(input$save_inputs)
observeEvent(save(),{
updateButton(session,"save_inputs",label = " Save",block = T,style = "success",icon=icon(name="save"))
})
})
}
ui <- fluidPage(
module_company_ui("company")
)
server <- function(input,session) {
module_save_inputs("company")
}
shinyApp(ui,server)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)