问题描述
当我想创建提交按钮时,我只是停留在 observeEvent 中,当我点击时,该事件不会执行任何操作,例如我的模态代码:
column(width = 6,bs4Card(width = 12,collapsible = FALSE,title = "Follow Up",selectInput("cara_fu","Cara Follow up",choices = c('Call','Whatsapp','Visit')),selectInput("hasil_fu","Hasil Follow up",choices = c('Survey','Batal','Unreachable')),textAreaInput("ket_fu","Keterangan",height = '100px'),footer = actionButton("submit_fu","Submit",status = "success")
)
)
然后当表单被值输入时,observeEvent 将由此代码生成:
# IF USER CLICKS SUBMIT FOLLOWUP,SAVE THE DATA IN DATABASE
observeEvent(input$submit_fu,{
text = tagList(
selectInput("cara_fu",'Visit'),selected = df$cara_fu),'Unreachable'),selected = df$hasil_fu),textInput("ket_fu","Keterangan")
)
}) # End observe submit button
当这个按钮没有任何反应时,我很高兴你们都能在这里找到问题所在,谢谢
这里是完整的代码:
shiny::observeEvent(input$current_id,{
shiny::req(!is.null(input$current_id) &
stringr::str_detect(input$current_id,pattern = "followup"
))
rv$dt_row <- which(stringr::str_detect(rv$df$Buttons,pattern = paste0("\\b",input$current_id,"\\b")
))
showModal(
modalDialog(title = "Followup",easyClose = TRUE,size = "l",fluidPage(
fluidRow(
column(width = 6,title = "Profile Summary",BoxProfile(
image = "https://adminlte.io/themes/AdminLTE/dist/img/user4-128x128.jpg",title = (rv$df$nama_customer[rv$dt_row]),subtitle =(rv$df$no_hp_customer[rv$dt_row]),bordered = TRUE,BoxProfileItem(
title = "Jadwal Followup",description =rv$df$scheduled_followup[rv$dt_row]),BoxProfileItem(
title = "Produk",description = rv$df$produk[rv$dt_row]),BoxProfileItem(
title = "Status",description = rv$df$status[rv$dt_row])
)
),title = "History Followup",timelineBlock(
width = 12,timelineLabel(as.Date(Sys.Date()),color = "primary"),timelineItem(
title = "Followup 1",icon = icon("book"),color = "secondary",time = "Now","This is the body"
),timelineItem(
title = "Followup 3",color = "secondary"
)
)
)
),column(width = 6,status = "success")
)
)
)
),footer = tagList(
modalButton("Cancel"),actionButton("ok","OK")
)
)
)
observeEvent(input$submit_fu,{
text = tagList(
selectInput("cara_fu","Keterangan")
)
}) # End observe submit button
}) # End observe followup button
}
# Run the application
shinyApp(ui = ui,server = server)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)