Quantcast
Viewing all articles
Browse latest Browse all 205399

How to make the search box have the same format as the output in DT?

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.
enter image description here

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)

Viewing all articles
Browse latest Browse all 205399

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>