DT: Dynamically change column values based on selectinput from another column in R shiny app

I’d suggest using dataTableProxy along with replaceData to realize the desired behaviour. This is faster than re-rendering the datatable. Furthermore, re-rendering the table seems to be messing around with the bindings of the selectInputs. Also please note: for this to work I needed to switch to server = TRUE library(DT) library(shiny) selectInputIDs <- paste0(“sel”, 1:10) … Read more

R Shiny set DataTable column width

Try this #OUTPUT – dtdata output$table <- DT::renderDataTable({ data.frame(a=c(1,2,3,4,5),b=c(“A”,”B”,”C”,”D”,”E”)) }, options = list( autoWidth = TRUE, columnDefs = list(list(width=”200px”, targets = “_all”)) )) Sets the width of all columns to 200px. To set width of selected columns, change targetsto a number or vector. targets = c(1,3)

Shiny: Merge cells in DT::datatable

It is possible with the help of the datatables-rowsgroup library. Here is an example: library(shiny) library(DT) dat <- iris[c(1,2,3,51,52,53,101,102,103), c(5,1,2,3,4)] ui <- fluidPage( DTOutput(“table”) ) server <- function(input, output){ output[[“table”]] <- renderDT({ dtable <- datatable(dat, rownames = FALSE, options = list( rowsGroup = list(0) # merge cells of column 1 )) path <- “U:/Data/shiny/DT/www” # … Read more

render dropdown for single column in DT shiny

I blatantly stole the idea from Yihui’s app for including radioButtons in DT. Code: library(shiny) library(DT) ui <- fluidPage( title=”Selectinput column in a table”, h3(“Source:”, tags$a(“Yihui Xie”, href = “https://yihui.shinyapps.io/DT-radio/”)), DT::dataTableOutput(‘foo’), verbatimTextOutput(‘sel’) ) server <- function(input, output, session) { data <- head(iris, 5) for (i in 1:nrow(data)) { data$species_selector[i] <- as.character(selectInput(paste0(“sel”, i), “”, choices = … Read more