Closed tanyanchongDA closed 3 years ago
Hi everyone,
I am facing issues with using reactiveValues() and datatable.
I have a minimally reproducible example below.
library(shiny) library(shinydashboard) library(tidyverse) library(DT) ui <- fluidPage( actionButton( "button", "Generate" ), DTOutput("test") ) server <- function(input, output){ rResult <- reactiveValues() observeEvent(input$button, { rResult$iris <- iris }) output$test <- renderDT({ datatable(rResult$iris) }) } shinyApp(ui, server)
There are no issues with the above. The code runs.
However, when I try to format the number of decimal places using formatRound, it cannot make reference to the columns.
library(shinydashboard) library(tidyverse) library(DT) ui <- fluidPage( actionButton( "button", "Generate" ), DTOutput("test") ) server <- function(input, output){ rResult <- reactiveValues() observeEvent(input$button, { rResult$iris <- iris }) output$test <- renderDT({ datatable(rResult$iris) %>% formatRound(c("Sepal.Length", digits = 0)) }) } shinyApp(ui, server)
I have been trying to search online for results, but to no avail. Would be glad if you could help.
I think changing the following line should solve your problem:
formatRound(c("Sepal.Length", digits = 0))
to
formatRound("Sepal.Length", digits = 0)
Hi everyone,
I am facing issues with using reactiveValues() and datatable.
I have a minimally reproducible example below.
There are no issues with the above. The code runs.
However, when I try to format the number of decimal places using formatRound, it cannot make reference to the columns.
I have been trying to search online for results, but to no avail. Would be glad if you could help.