默认选择值时显示 pickerInput() 标题
Display pickerInput() title when values are selected by default
我想知道如何设置要显示的 pickerInput()
的标题 -"Please select a month"
- 当默认选择值时。
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
pickerInput(
inputId = "month",
label = "Select a month",
choices = month.name,
selected = month.name,
multiple = TRUE,
options = pickerOptions(
actionsBox = TRUE,
title = "Please select a month",
header = "This is a title"
)
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
“请 select 一个月”将显示在选取器本身中,但仅在初始执行时显示。同样在初始执行时,所有月份都是 selected。当观察到选择器的任何事件时,选择器本身将显示 selected 值。
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
pickerInput(
inputId = "month",
label = "Select a month",
choices = month.name,
selected = month.name,
multiple = TRUE,
options = pickerOptions(
actionsBox = TRUE,
title = "Please select a month",
selectedTextFormat = 'static',
header = "This is a title"
)
)
)
server <- function(input, output, session) {
observeEvent(input$month, {
updatePickerInput(session = session, inputId = "month",options = pickerOptions(selectedTextFormat = 'values'))
}, ignoreInit = TRUE)
}
shinyApp(ui, server)
我想知道如何设置要显示的 pickerInput()
的标题 -"Please select a month"
- 当默认选择值时。
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
pickerInput(
inputId = "month",
label = "Select a month",
choices = month.name,
selected = month.name,
multiple = TRUE,
options = pickerOptions(
actionsBox = TRUE,
title = "Please select a month",
header = "This is a title"
)
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
“请 select 一个月”将显示在选取器本身中,但仅在初始执行时显示。同样在初始执行时,所有月份都是 selected。当观察到选择器的任何事件时,选择器本身将显示 selected 值。
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
pickerInput(
inputId = "month",
label = "Select a month",
choices = month.name,
selected = month.name,
multiple = TRUE,
options = pickerOptions(
actionsBox = TRUE,
title = "Please select a month",
selectedTextFormat = 'static',
header = "This is a title"
)
)
)
server <- function(input, output, session) {
observeEvent(input$month, {
updatePickerInput(session = session, inputId = "month",options = pickerOptions(selectedTextFormat = 'values'))
}, ignoreInit = TRUE)
}
shinyApp(ui, server)