Learn R Programming

shinyMobile (version 0.7.0)

f7SmartSelect: Create a Framework7 smart select

Description

It is smarter than the classic f7Select

Usage

f7SmartSelect(
  inputId,
  label,
  choices,
  selected = NULL,
  openIn = c("page", "sheet", "popup", "popover"),
  searchbar = TRUE,
  multiple = FALSE,
  maxlength = NULL,
  virtualList = FALSE
)

Arguments

inputId

Select input id.

label

Select input label.

choices

Select input choices.

selected

Default selected item.

openIn

Smart select type: either c("sheet", "popup", "popover"). Note that the search bar is only available when the type is popup.

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.

Examples

Run this code
# NOT RUN {
if (interactive()) {
library(shiny)
library(shinyMobile)

 shinyApp(
   ui = f7Page(
     title = "My app",
     f7SingleLayout(
       navbar = f7Navbar(title = "f7SmartSelect"),
       f7SmartSelect(
         inputId = "variable",
         label = "Choose a variable:",
         selected = "drat",
         choices = colnames(mtcars)[-1],
         openIn = "popup"
       ),
       tableOutput("data")
     )
   ),
   server = function(input, output) {
     output$data <- renderTable({
       mtcars[, c("mpg", input$variable), drop = FALSE]
     }, rownames = TRUE)
   }
 )
}
# }

Run the code above in your browser using DataLab