jquery - How to right align columns of DataTable in R Shiny? -


from this post gather should define alignright css class desired alignment:

# ui.r sidebarlayout(...,     mainpanel(         tags$head(             tags$style(".alignright { align: right; }", media = "all", type = "text/css")         ),         ...     # content call datatableoutput("mytable")     ) ) 

and when creating datatable, use aocolumndefs option set class of desired columns alignright:

# server.r shinyserver(     function(input, output) {...         output$mytable <- renderdatatable(...,             options = list(                 aocolumndefs = '[{"atargets": [7, 9, 10], "sclass": "alignright"}]'             )         )     } ) 

however, has had no effect on datatable, when remains left aligned columns. thought simple alignment issue easy sort out, after many hours, apparently not so. ideas appreciated.

this:

library(shiny)  runapp(list(   ui = basicpage(     tags$head(tags$style(".table .alignright {color: blue; text-align:right;}")),     h2('the mtcars data'),     datatableoutput('mytable')   ),   server = function(input, output) {     output$mytable = renderdatatable({       mtcars     }, options =list(aocolumndefs = list(list(sclass="alignright",atargets=c(list(3),list(4),list(5))))  ))   } )) 

worked me , might model css right situation. used blue since helps show if other parts of td formatting working if 1 might not be.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -