我正在尝试创建一个交互式 UI,它在用户与其交互时要求提供更多详细信息。我添加了一个 bsButton,它应该插入更多输入选项以收集更多详细信息,但是单击该按钮时不会插入 UI。对代码有任何帮助或建议吗?提前致谢。
ui <- shinyUI( #UI
dashboardPage(
fluidPage(
fluidRow(
introBox(
bsButton("pricing_request", #button to insert UI to collect more details
label = "Pricing Request",
icon = icon("car-battery"),
style = "success")
)))))
#serverpart
server <- function(input, output, session) {
observeEvent(input$pricing_request,{
insertUI(
selector = "#add",
where = "afterEnd",
ui = box( #UI to be inserted
bootstrapPage(
div(style="float:right", actionButton("add_request",
label = "add option",
icon = icon("plus"),
style = "arial")),
div(style="display:inline-block",
textInput(
inputId = "option_1",
label = "Option",
width = '350px',
value = "insert option"))))
)})}