diff --git a/R/shiny.R b/R/shiny.R index 580b24529..660214f99 100644 --- a/R/shiny.R +++ b/R/shiny.R @@ -38,10 +38,15 @@ ShinyApp <- setRefClass( return(paste("data:image/png;base64,", b64, sep='')) }) }, - define.table.output = function(name, func) { + define.table.output = function(name, func, ...) { .outputs$set(name, function() { data <- func() - return(paste(capture.output(print(xtable(data), type='html')), collapse="\n")) + return(paste( + capture.output( + print(xtable(data, ...), + type='html', + html.table.attributes='class="data"')), + collapse="\n")) }) }, instantiate.outputs = function() { @@ -147,8 +152,8 @@ start.app <- function(app, www.root, sys.www.root=NULL, port=8101L) { define.shiny.plot <- function(name, func, ...) { shinyapp$define.plot.output(name, func, ...) } - define.shiny.table <- function(name, func) { - shinyapp$define.table.output(name, func) + define.shiny.table <- function(name, func, ...) { + shinyapp$define.table.output(name, func, ...) } get.shiny.input <- function(name) { shinyapp$session$get(name) diff --git a/examples/03_distributions/www/index.html b/examples/03_distributions/www/index.html index 39b76c530..d14be5ab3 100644 --- a/examples/03_distributions/www/index.html +++ b/examples/03_distributions/www/index.html @@ -19,7 +19,7 @@


- +

diff --git a/www/shared/shiny.css b/www/shared/shiny.css index 04889b6a2..03015cca7 100644 --- a/www/shared/shiny.css +++ b/www/shared/shiny.css @@ -2,3 +2,14 @@ body.disconnected { background-color: #999; opacity: 0.5; } + +table.data { + border-collapse: collapse; +} +table.data td, table th { + border: 1px solid #CCC; + padding: 3pt 8pt; +} +table.data td[align=right] { + font-family: monospace; +} \ No newline at end of file