我正在开发一个闪亮的应用程序,使用伟大的 shinyglide 包创建一个模式供用户输入一些信息。问题是在第一个屏幕上我需要创建一个条件,以便用户必须输入一个值才能继续。不幸的是,我不能next_condition
在第一个屏幕上使用该命令,似乎只能在第二个屏幕上工作。
当我单击“下一步”按钮,然后使用“返回”按钮返回到第一个屏幕时,条件有效,我无法继续,直到我单击至少一个选项,但第一次它不起作用方法。
这种行为正常吗?在这种情况下是否可以设置另一种类型的条件?
我做了一个小例子来说明问题:
library(shiny)
library(shinyglide)
ui <- fixedPage(
titlePanel("shinyglide modal example"),
sidebarLayout(
sidebarPanel(
p('Hello World')
),
mainPanel()
)
)
server <- function(input, output, session) {
modal_controls <- glideControls(
list(prevButton(),
firstButton(class = "btn btn-danger",`data-dismiss`="modal","No, thanks !")),
list(nextButton(),
lastButton(class = "btn btn-success",`data-dismiss`="modal","Done"))
)
glide_modal <- modalDialog(
title = "Startup assistant",easyClose = FALSE,footer = NULL,
glide(custom_controls = modal_controls,
screen(next_condition="input.options.length > 0",
p("First, please select an option"),
checkboxGroupInput("options", "Options", choices=c('a','b','c'),selected=NULL)
),
screen(p("Next, please select a number"),
numericInput("number", "Number", value = 1, min = 0)
),
screen(p("Thanks, we're all set !"))
)
)
showModal(glide_modal)
}
shinyApp(ui, server)