Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 在R数据表中添加单元格边框_Css_R_Shiny_Dt - Fatal编程技术网

Css 在R数据表中添加单元格边框

Css 在R数据表中添加单元格边框,css,r,shiny,dt,Css,R,Shiny,Dt,对于R来说,这是一个相当新的概念——在大画面上做得很好,当我想向其他人展示一些东西时,努力清理边缘 在一个闪亮的应用程序的datatable中,用一些可能非常简单的东西来砸我的头——我只想在所有的单元格中添加单元格边框。下面是一段相关的代码: library(ggplot2) library(shiny) library(data.table) library(DT) library(plotly) setwd("C:/Users/Will/Desktop/FinalPages") list

对于R来说,这是一个相当新的概念——在大画面上做得很好,当我想向其他人展示一些东西时,努力清理边缘

在一个闪亮的应用程序的datatable中,用一些可能非常简单的东西来砸我的头——我只想在所有的单元格中添加单元格边框。下面是一段相关的代码:

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, ' ')
    )

    filterone <- subset(totals, Name == input$players)

    filterone <- filterone[,-1:-2]

    DT::datatable(filterone,
                  rownames = FALSE,

                  options=list(iDisplayLength=7,                    
                               bPaginate=FALSE,                  
                               bLengthChange=FALSE,                       
                               bFilter=FALSE,                                    
                               bInfo=FALSE,
                               rowid = FALSE,
                               autoWidth = FALSE,
                               ordering = FALSE,
                               scrollX = TRUE,
                               borders = TRUE,
                               columnDefs = list(list(className = 'dt-center', targets ="_all"))
                  ))
  }
  )
库(ggplot2)
图书馆(闪亮)
库(数据表)
图书馆(DT)
图书馆(绘本)
setwd(“C:/Users/Will/Desktop/finalpage”)

lister您正在寻找的函数是:
formatStyle(“您的DT表”、“列索引向量”,border='1px solid 35; ddd')

您可以在此处找到一个可复制的示例:

library(shiny)
library(DT)

shinyApp(
  ui = fluidPage(
   DT::dataTableOutput("test")
  ),

 server = function(input, output, session) {
   output$test <- DT::renderDataTable({
     datatable(mtcars) %>% 
     formatStyle(c(1:dim(mtcars)[2]), border = '1px solid #ddd')
   })
})
库(闪亮)
图书馆(DT)
shinyApp(
ui=fluidPage(
DT::dataTableOutput(“测试”)
),
服务器=功能(输入、输出、会话){
输出$test%
格式样式(c(1:dim(mtcars)[2]),边框='1px solid#ddd')
})
})

一定有更优雅的方式,但它的工作

您正在寻找的函数是:
formatStyle(“您的DT表”、“列索引向量”,border='1px solid#ddd')

您可以在此处找到一个可复制的示例:

library(shiny)
library(DT)

shinyApp(
  ui = fluidPage(
   DT::dataTableOutput("test")
  ),

 server = function(input, output, session) {
   output$test <- DT::renderDataTable({
     datatable(mtcars) %>% 
     formatStyle(c(1:dim(mtcars)[2]), border = '1px solid #ddd')
   })
})
库(闪亮)
图书馆(DT)
shinyApp(
ui=fluidPage(
DT::dataTableOutput(“测试”)
),
服务器=功能(输入、输出、会话){
输出$test%
格式样式(c(1:dim(mtcars)[2]),边框='1px solid#ddd')
})
})
一定有更优雅的方式,但它的工作