Hello, I have a dumb question about how to set individual column width for a datatable.
Here's my sample code:
library(shiny)
library(DT)
runApp(list(
ui = navbarPage(
title = 'Tables',
tabPanel('test',
numericInput('nmb', label="change number of columns", value=2,min=1,max=10,step=1)
,
DT::dataTableOutput('table1')
)),
server = function(input, output) {
Tab <- reactive({
n <- input$nmb
return(iris[,1:n])
})
output$table1 <- DT::renderDataTable({
datatable(Tab(),rownames=FALSE)
})
}
))
Actually, I'm trying to display a dataframe whose number of columns depends on a user-input number.
Is there a nice way to define different column width individually from the server side? For example, 200px for 1st col, 300px for 2nd, etc.
Is it possible to let the user define them via an Input widget in UI?
I'm no sure if I describe my question clearly. THANKS!