Description Usage Arguments Value Examples
View source: R/server-treeview.R
Search a treeviewInput
1 2 3 4 5 6 7 8 9 |
inputId |
The id of the input object. |
pattern |
Pattern to search for. |
ignore_case |
Case insensitive. |
exact_match |
Like or equals. |
reveal_results |
Reveal matching nodes. |
collapse_before |
Collapse all nodes before revealing results. |
session |
The session object passed to function given to shinyServer. |
None.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | library(shiny)
library(shinytreeview)
data("countries")
ui <- fluidPage(
tags$h3("treeviewInput search example"),
fluidRow(
column(
width = 4,
treeviewInput(
inputId = "country",
label = "Choose a country:",
choices = make_tree(
countries, c("continent", "subregion", "name")
),
width = "100%"
)
),
column(
width = 8,
textInput("search", "Search a country"),
tags$b("Selected country:"),
verbatimTextOutput(outputId = "result")
)
)
)
server <- function(input, output, session) {
output$result <- renderPrint({
input$country
})
observeEvent(input$search, {
searchTreeview(
inputId = "country",
pattern = input$search,
reveal_results = TRUE
)
})
}
if (interactive())
shinyApp(ui, server)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.