Shiny 如何使rhandsontable中的列标题字母加粗
如何在r的闪亮包中使rhandsontable中的列标题为粗体文本Shiny 如何使rhandsontable中的列标题字母加粗,shiny,rstudio,rhandsontable,Shiny,Rstudio,Rhandsontable,如何在r的闪亮包中使rhandsontable中的列标题为粗体文本 我有一个闪亮的rhandsontable,我想在标题中加粗文本。我怎么做?有人知道吗?rhandsontable是Handsontable.js库的接口,因此可以使用CSS对其进行自定义。以以下数据帧为例: DF = data.frame(column.one = 1:10, column.two = TRUE) rhandsontable(DF) 看起来没有任何定制 但如果指定使用CSS,则
我有一个闪亮的rhandsontable,我想在标题中加粗文本。我怎么做?有人知道吗?rhandsontable是Handsontable.js库的接口,因此可以使用CSS对其进行自定义。以以下数据帧为例:
DF = data.frame(column.one = 1:10,
column.two = TRUE)
rhandsontable(DF)
看起来没有任何定制
但如果指定使用CSS,则可以引用它:
DF = data.frame(column.one = 1:10,
column.two = TRUE)
func = "function (col) { # custom CSS
switch (col) {
case 0:
return '<b>Bold</b> and <em>Italics</em>';
case 1:
return '<em>Bold</em> and <b>Italics</b>';
}
}"
rhandsontable(DF, colHeaders = htmlwidgets::JS(func))
DF=data.frame(column.one=1:10,
第2列=真)
func=“函数(列){#自定义CSS
开关(col){
案例0:
返回“粗体和斜体”;
案例1:
返回“粗体和斜体”;
}
}"
rhandsontable(DF,colHeaders=htmlwidgets::JS(func))
而你最终得到的是
确保在调用rhandsontable函数时指定colHeaders参数 rhandsontable是Handsontable.js库的接口,因此可以使用CSS对其进行自定义。以以下数据帧为例:
DF = data.frame(column.one = 1:10,
column.two = TRUE)
rhandsontable(DF)
看起来没有任何定制
但如果指定使用CSS,则可以引用它:
DF = data.frame(column.one = 1:10,
column.two = TRUE)
func = "function (col) { # custom CSS
switch (col) {
case 0:
return '<b>Bold</b> and <em>Italics</em>';
case 1:
return '<em>Bold</em> and <b>Italics</b>';
}
}"
rhandsontable(DF, colHeaders = htmlwidgets::JS(func))
DF=data.frame(column.one=1:10,
第2列=真)
func=“函数(列){#自定义CSS
开关(col){
案例0:
返回“粗体和斜体”;
案例1:
返回“粗体和斜体”;
}
}"
rhandsontable(DF,colHeaders=htmlwidgets::JS(func))
而你最终得到的是
确保在调用rhandsontable函数时指定colHeaders参数 您可以在表格中添加一些
样式
,如下所示:
library(shiny)
library(rhandsontable)
ui <- fluidPage(
rHandsontableOutput("table1"),
tags$style(type="text/css", "#table1 th {font-weight:bold;}")
)
server=function(input, output, session) {
output$table1 <- renderRHandsontable({
rhandsontable(mtcars,rowHeaders=F)
})
}
shinyApp(ui,server)
库(闪亮)
图书馆(rhandsontable)
ui您可以向表中添加一些样式
,如下所示:
library(shiny)
library(rhandsontable)
ui <- fluidPage(
rHandsontableOutput("table1"),
tags$style(type="text/css", "#table1 th {font-weight:bold;}")
)
server=function(input, output, session) {
output$table1 <- renderRHandsontable({
rhandsontable(mtcars,rowHeaders=F)
})
}
shinyApp(ui,server)
库(闪亮)
图书馆(rhandsontable)
ui library(闪亮的)library(数据集)library(rhandsontable)ui=fluidPage(br(),br(),actionButton(“更新”,“开始”,class=“成功”),br(),br(),rHandsontableOutput(“table1”))server=function(输入,输出,会话){mt=reactive({datacopy=data.table(mtcars)datacopy[16,“wt”]我应该如何加粗列标题,并且一旦单击“go”按钮,我希望468加粗。库(闪亮)库(数据集)库(rhandsontable)ui=fluidPage(br(),br(),actionButton(“update”,“go”,class=“success”),br(),br(),rHandsontableOutput(“table1”))服务器=函数(输入,输出,会话){mt=reactive({datacopy=data.table(mtcars)datacopy[16,“wt”]我应该如何加粗列标题,而且一旦我单击“go”按钮,我希望468加粗。太好了!!谢谢你如何只向选定列标题而不是向所有列添加样式?太好了!!谢谢你如何只向选定列标题而不是向所有列添加样式?