I am using DataTable in Rshiny app to display the content of the Dataframe. But one element of the dataframe is of text, can have characters more than 1000. When I am displaying the datatable it shows all the text. I want to truncate it to first 250 characters and when hover it should show the full text. How can I do that?
ui.r
shinyUI(fluidPage(
theme = shinythemes::shinytheme("flatly"),
titlePanel("title"),
sidebarLayout(
sidebarPanel(
width=0
),
mainPanel(
width=12,
tabsetPanel(tabPanel("Data",DT::dataTableOutput("train_data",width = "100%")))
)
)
))
server.r
output$train_data <- renderDataTable({
if(is.null(camry_data$train_data)){return ()}
DT::datatable(camry_data$train_data, options = list(lengthMenu = c(5,10)),class = "display")
})