Improve default table styles

This commit is contained in:
Joe Cheng
2012-06-27 10:44:49 -07:00
parent 228a83e0a7
commit cc51dbd4e6
3 changed files with 21 additions and 5 deletions

View File

@@ -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)

View File

@@ -19,7 +19,7 @@
<p>
<label>Number of observations:</label><br />
<input type="numeric" name="n" value="500" />
<input type="number" name="n" value="500" min="1" max="10000" />
</p>
<div id="plot1" class="live-plot"></div>

View File

@@ -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;
}