R DT数据表字体大小更改 [英] R DT datatable font size change
本文介绍了R DT数据表字体大小更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想更改整个数据表的字体大小.对于我要显示的内容,默认大小太大.我正在尝试使用 formatStyle
如下更改变量名和列内容的字体大小
I want to change the font size of the entire data table., The default size is too large for what I want to display. I am trying to change the font-size of variable names and column content with formatStyle
as follows
library(DT)
library(magrittr)
iris %>%
datatable() %>%
formatStyle(columns = colnames(.), `font-size` = '25%')
但是,无论更改如何,呈现的都是相同的字体大小.尝试了不同的字体大小格式,例如大,小","150%,50%"和"10px,20px,30px"
But, what is rendered is the same font size regardless of the changes. Tried different formats for font-size such as 'large, small' '150%, 50%' and '10px,20px,30px'
推荐答案
datatable(head(iris, 20), options = list(
initComplete = JS("
function(settings, json) {
$(this.api().table().header()).css({
'font-size': '12px',
});
}
")
)) %>%
formatStyle(columns = colnames(.$x$data), `font-size` = "12px")
这篇关于R DT数据表字体大小更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文