I'm trying to do something like is seen here, but I'm having trouble figuring out how to do it in Shiny. As an example, it would be great to have a filter for mtcars
of "efficient" (cars with at least 15 mpg) or "inefficient" (cars with less than 15 mpg).
Here is some code:
library(shiny)
library(DT)
ui <- shinyUI(
fluidPage(DT::dataTableOutput("mtcars_table"))
)
server <- shinyServer(function(input, output, session) {
output$mtcars_table <-
DT::renderDT({
DT::datatable(
mtcars,
options = list(dom = 'Pfrtip',
columnDefs = list(
list(
searchPanes = list(show = TRUE), targets = 1
),
list(
searchPanes = list(show = FALSE), targets = 2:11
))),
extensions = c('Select', 'SearchPanes'),
selection = 'none'
)
}, server = FALSE)
})
shinyApp(ui = ui, server = server)