Question
#This shinny app creates a search Bar feature which shows suggestions in real time as soon as user starts #typing in the search bar I don't have clear idea how the last part of the code works: " Any explanation of I() functions is used with dropdown and ontype in the last two lines of the "UI" part? is this R code or CSS code? any tutorial reference or readable source for such code will be appreciated.
library(shiny)
ui <- fluidPage(
title = "Search Bar",
fluidRow(
selectizeInput(
inputId = "searchme",
label = "Search Bar",
multiple = FALSE,
choices = c("Search Bar" = "", paste0(LETTERS,sample(LETTERS, 26))),
options = list(
create = FALSE,
placeholder = "Search Me",
maxItems = '1',
onDropdownOpen = I("function($dropdown) {if (!this.lastQuery.length) {this.close(); this.settings.openOnFocus = false;}}"),
onType = I("function (str) {if (str === \"\") {this.close();}}")
)
))
)
server <- function(input, output, session) {
# Show Selected Value in Console
observe({
print(input$searchme)
})
}
shinyApp(ui, server)
I was trying to create search bar and found this code but could not understand the last two lines of the "ui' Part very well. is this R code or CSS code? any tutorial reference or readable source for such code will be appreciated.