I'm trying to format datatable in R using DT package. I have code like this:
library(data.table) library(DT) data<-data.table(rbind(c(1,2,3),c(4,5,6))) colnames(data)<- c('A','B','c') datatable(data, rownames=F, colnames=c('A','B','C'), class='stripe cell-border hover', options=list( pageLength=100, dom='ltp', initComplete = JS(" function(settings, json) { $(this.api().table().body()).css({ 'background-color': 'red', 'outline-color': 'red', 'margin':'100px', 'color': 'violet', 'text-align': 'center', 'font-family': 'Courier New', 'border-radius': '25px' }); $(this.api().table().header()).css({ 'background-color': '#000', 'color': '#fff', 'outline-color': 'red', 'margin':'100px', 'text-align': 'center', 'font-family': 'Courier New', 'border-radius': '25px' }); } ") ), caption = htmltools::tags$caption( style = 'caption-side: top; text-align: center; color:black; font-size:200% ;','Table'), filter=list(position = 'top') ) And I have problem with javascript in function JS(). It modifies background color (but only in header), font color and style. But commands to align text or round corners don't work. Why does it work like that? And how can I modify code to format this other things? Regards, Jeddite [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.