我正在努力使数据表的一列中的文本不被换行。

我想避免在第一列中换行(因为这是使行大小变大的唯一部分),但应将选项保留在标题中(以避免滚动)。
我尝试过调整第一列的宽度,但是无论我使用什么大小,文本都会自动换行。
DT::datatable(chartfilter,
rownames = FALSE,
options=list(iDisplayLength=7,
bPaginate=FALSE,
bLengthChange=FALSE,
bFilter=FALSE,
bInfo=FALSE,
rowid = FALSE,
autoWidth = FALSE,
ordering = FALSE,
scrollX = TRUE,
columnDefs = list(list(width='500px', targets = list(1)))
Run Code Online (Sandbox Code Playgroud)
我还找到了一种解决方案,可以关闭整个表中的文字换行功能-但我不希望列标签使用这种方式。将其添加到tableoutput前面的UI中:
tags$style(HTML("#charttable {white-space: nowrap; }")),
Run Code Online (Sandbox Code Playgroud)
这可能吗,还是我只需要在第一列中接受换行文本?感谢您可以获得的任何帮助,如果需要更多信息,请告诉我。
R 相当新 - 处理大图的东西还可以,当我想向其他人展示一些东西时,努力清理边缘。
用一些可能非常简单的东西将我的头撞在墙上 - 我只是想在一个闪亮的应用程序的数据表中添加单元格边框 - 到所有单元格。这是一段相关的代码:
library(ggplot2)
library(shiny)
library(data.table)
library(DT)
library(plotly)
setwd("C:/Users/Will/Desktop/FinalPages")
lister <- read.table("PlayerList.csv", header=TRUE, quote ="", sep=",",fill = TRUE)
totals <- read.table("TotShooting.csv", header=TRUE, quote ="", sep=",",fill = TRUE)
items <- as.character(lister[[1]])
ui <- fluidPage(
sidebarLayout(
sidebarPanel(selectizeInput("players", "Player:", choices = items, multiple = FALSE),
width=2
),
mainPanel(h5("Total Shooting", align = "center"),
div(dataTableOutput("tot"), style = "font-size:80%", class = 'table-condensed cell-border row-border'),
position="center",
width = 10)
)
)
server <- function(input, output) {
output$tot <- DT::renderDataTable({
validate(
need(input$players, …Run Code Online (Sandbox Code Playgroud)