闪亮 - renderTable / renderDataTable行的文本样式

时间:2017-01-24 03:05:43

标签: r shiny

如何以粗体显示renderTable中前两行的文本?我可以在没有DT / renderDataTable的情况下这样做吗?

2 个答案:

答案 0 :(得分:2)

这个怎么样:

shinyApp(
  ui = fluidPage(
    tags$head(
      tags$style(
        HTML("tr:first-child, tr:first-child + tr { font-weight: bold }")
      )
    ),
    fluidRow(
      column(12, tableOutput('table')
      )
    )
  ),
  server = function(input, output) {
    output$table <- renderTable(head(iris))
  }
)

答案 1 :(得分:1)

试试这个:

library(shiny)

ui <- fluidPage(
    tags$head(
        tags$style(
            "tr:nth-child(1) {font-weight: bold;}
             tr:nth-child(2) {font-weight: bold;}
            "
        )
    ),
    tableOutput("tbl")
)

server <- function(input, output){

    output$tbl <- renderTable({iris})
}

shinyApp(ui, server)