f7SmartSelect {shinyMobile} | R Documentation |
Framework7 smart select
Description
f7SmartSelect
is smarter than the classic f7Select,
allows for choices filtering, ...
updateF7SmartSelect
changes the value of a smart select input on the client.
Usage
f7SmartSelect(
inputId,
label,
choices,
selected = NULL,
openIn = c("page", "sheet", "popup", "popover"),
searchbar = TRUE,
multiple = FALSE,
maxLength = NULL,
virtualList = FALSE,
...
)
updateF7SmartSelect(
inputId,
selected = NULL,
choices = NULL,
multiple = NULL,
maxLength = NULL,
...,
session = shiny::getDefaultReactiveDomain()
)
Arguments
inputId |
Select input id. |
label |
Select input label. |
choices |
Select input choices. |
selected |
Default selected item. If NULL, the first item is selected. |
openIn |
Smart select type: either |
searchbar |
Whether to enable the search bar. TRUE by default. |
multiple |
Whether to allow multiple values. FALSE by default. |
maxLength |
Maximum items to select when multiple is TRUE. |
virtualList |
Enable Virtual List for smart select if your select has a lot of options. Default to FALSE. |
... |
Other options. See https://framework7.io/docs/smart-select#smart-select-parameters. |
session |
The Shiny session object, usually the default value will suffice. |
Examples
library(shiny)
library(shinyMobile)
app <- shinyApp(
ui = f7Page(
title = "Update f7SmartSelect",
f7SingleLayout(
navbar = f7Navbar(title = "Update f7SmartSelect"),
f7Block(f7Button("update", "Update Smart Select")),
f7List(
inset = TRUE,
strong = TRUE,
outline = TRUE,
f7SmartSelect(
inputId = "smartselect",
label = "Choose a variable:",
choices = split(colnames(mtcars[-1]), rep(1:5)),
openIn = "popup"
)
),
tableOutput("data")
)
),
server = function(input, output, session) {
output$data <- renderTable(
mtcars[, c("mpg", input$smartselect), drop = FALSE],
rownames = TRUE
)
observeEvent(input$update, {
updateF7SmartSelect(
inputId = "smartselect",
openIn = "sheet",
selected = "hp",
choices = c("hp", "gear", "carb"),
multiple = TRUE,
maxLength = 2
)
})
}
)
if (interactive() || identical(Sys.getenv("TESTTHAT"), "true")) app