I have a simple shiny
app in which I display percentages in some columns of a DT
table. Is it possible to make the search box have the same format as the output?
Image may be NSFW.
Clik here to view.
library(shiny)
library(DT)
library(dplyr)
ui <- basicPage(
h2("The mtcars data"),
DT::dataTableOutput("mytable")
)
server <- function(input, output) {
mydata <- mtcars %>%
mutate(mpg = mpg/max(mtcars$mpg),
cyl = cyl/max(mtcars$cyl))
output$mytable = DT::renderDataTable({
datatable(mydata,filter="top", selection="multiple" ) %>%
formatPercentage(c("mpg", "cyl"), 2)
})
}
shinyApp(ui, server)