Reputation: 99
from the below dataset, can we split the line in Cola into 2 lines as shown in expected output? The same line but splitted into 2 lines?
library(shiny)
library(DT)
ui <- fluidPage(
DTOutput("example_table")
)
server <- function(input, output, session) {
new_data <- data.frame(cola = c("fsdfdsgfsdgfdgfdgfdgdhgdgdfgdfgsfsgsfgsfdgfdgdfgfdgsfgfgfdgdd","fsgfdgfdgdfsdfgdfgdhdfgsdfsdfgfgdhdhfghfghfghsdfs"), b=c(1,2))
output$example_table <- DT::renderDT({
datatable(new_data,escape = FALSE)
})
}
shinyApp(ui, server)
Expected output
Upvotes: 0
Views: 678
Reputation: 33417
You can simply insert <br>
at the point you want the line break.
library(shiny)
library(DT)
ui <- fluidPage(
DTOutput("example_table")
)
server <- function(input, output, session) {
new_data <- data.frame(cola = c("fsdfdsgfsdgfdgfdgfdgdhgdgd<br>fgdfgsfsgsfgsfdgfdgdfgfdgsfgfgfdgdd","fsgfdgfdgdfsdfgdfgdhdfgsdf<br>sdfgfgdhdhfghfghfghsdfs"), b=c(1,2))
output$example_table <- DT::renderDT({
datatable(new_data,escape = FALSE)
})
}
shinyApp(ui, server)
Upvotes: 3