I need to replicate View() basic functionality as described below but in a shiny datatable (DT::renderDataTable)
I have a table and couple of columns have very long text inside of them, I would like each rows to be displayed in just one line, column width is reasonable so for long text columns, data is wrapped and fully visible only when you hover over it like View() function display data frames.
Please find the minimum example bellow.
library(shiny)
library(DT)
df <- data.frame(A = 1:4, B = T, C = c("Healthcare company",
"tech company",
"develops, manufactures, and distributes antennas, system components, and repeater/rebroadcast systems to wireless communications and renewable energy markets in Australia and internationally. The company offers communications solutions, such as antennas, multicoupling and frequency translating repeater systems, lightning protection products, cables and connectors, batteries, industrial solar products, radio frequency power amplifiers and distribution equipment, and antenna site monitoring solutions for defense, LMR, public safety, and cellular applications in telecommunications, government, and public and private radio operator markets; and cellular distributed antenna systems, tunnel radio rebroadcast systems, and DAS to carriers and building contractors in shopping centers, multi-story office buildings and hospitals. It also engages in the wholesale distribution of solar power products, including stand alone or grid interactive systems and components, including modules, inverters, batteries, and balance of systems hardware; and renewable energy products, such as stand-alone remote area power, industrial, and grid-connect systems in Australia, as well as represents companies in DC and AC power markets. In addition, the company offers installation, consulting, and integrated system services; and site interference and remediation assistance services for large OEMs and integrator customers. It serves emergency service, industrial data collection, building service, and renewable energy providers through a network of resellers, systems integrators, and retail outlets; and a dealer network in the Australian renewable energy market",
"CPG company"),
D = c(1980, 1995, 2015, 2010))
#--------------------
ui <- fluidPage(
dataTableOutput("example_df")
)
server <- function(input, output) {
output$example_df <- renderDataTable({df})
}
shinyApp(ui, server)
When I run shiny app the data table's row including long texts takes a lot of space and makes it not useful to visualize data
the links before compare View() vs dataTableOutput(), the issue is I need that behavior but in a shiny app