Set max-width on a DT::renderDataTable()?

I would like to set a max width, as opposed to just width, on a DT::renderDataTable() in shiny.

Slight modification to out of the box shiny app within rstudio UI:

# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
# Find out more about building applications with Shiny here:


# Define UI for application that draws a histogram
ui <- fluidPage(

    # Application title
    titlePanel("Old Faithful Geyser Data"),

    # Sidebar with a slider input for number of bins 
                        "Number of bins:",
                        min = 1,
                        max = 50,
                        value = 30)

        # Show a plot of the generated distribution

# Define server logic required to draw a histogram
server <- function(input, output) {
    output$sometable <- DT::renderDataTable(
            y = 1:3
        extensions = c('Buttons', 'Scroller', 'FixedColumns'), 
        options = list(dom = 'Bt', scrollY = 400, scrollX = T,
                       scroller = T, buttons = c('copy', 'csv'), 
                       fixedColumns = list(leftColumns = 1)),
        rownames = F

    output$distPlot <- renderPlot({
        # generate bins based on input$bins from ui.R
        x    <- faithful[, 2]
        bins <- seq(min(x), max(x), length.out = input$bins + 1)

        # draw the histogram with the specified number of bins
        hist(x, breaks = bins, col = 'darkgray', border = 'white')

# Run the application 
shinyApp(ui = ui, server = server)

Looks like this:

Is there some way that I can set the maximum width of the x column? e.g. 100px? Show up to a max of 100px and then after that just chop the text from view?

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.