mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-07 03:00:20 -04:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
6
NEWS
6
NEWS
@@ -27,6 +27,12 @@ shiny 0.9.1.9XXX
|
||||
* `sliderInput` and `selectizeInput`/`selectInput` now use a standard horizontal
|
||||
size instead of filling up all available horizontal space.
|
||||
|
||||
* Fixed a bug of renderDataTable() when the data object only has 1 row and 1
|
||||
column. (Thanks, ZJ Dai, #429)
|
||||
|
||||
* `renderPrint` gained a new argument 'width' to control the width of the text
|
||||
output, e.g. renderPrint({mtcars}, width = 40).
|
||||
|
||||
shiny 0.9.1
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -82,10 +82,10 @@ workerId <- local({
|
||||
#' }
|
||||
#' }
|
||||
#' \code{clientData} also contains information about each output.
|
||||
#' \code{output_\emph{outputId}_width} and \code{output_\emph{outputId}_height}
|
||||
#' \code{output_\var{outputId}_width} and \code{output_\var{outputId}_height}
|
||||
#' give the dimensions (using \code{offsetWidth} and \code{offsetHeight}) of
|
||||
#' the DOM element that is bound to \code{\emph{outputId}}, and
|
||||
#' \code{output_\emph{outputId}_hidden} is a logical that indicates whether
|
||||
#' the DOM element that is bound to \code{\var{outputId}}, and
|
||||
#' \code{output_\var{outputId}_hidden} is a logical that indicates whether
|
||||
#' the element is hidden. These values may be \code{NULL} if the output is
|
||||
#' not bound.
|
||||
#' }
|
||||
|
||||
@@ -353,14 +353,15 @@ renderTable <- function(expr, ..., env=parent.frame(), quoted=FALSE, func=NULL)
|
||||
#' @param quoted Is \code{expr} a quoted expression (with \code{quote()})? This
|
||||
#' @param func A function that may print output and/or return a printable R
|
||||
#' object (deprecated; use \code{expr} instead).
|
||||
#'
|
||||
#' @param width The value for \code{\link{options}('width')}.
|
||||
#' @seealso \code{\link{renderText}} for displaying the value returned from a
|
||||
#' function, instead of the printed output.
|
||||
#'
|
||||
#' @example res/text-example.R
|
||||
#'
|
||||
#' @export
|
||||
renderPrint <- function(expr, env=parent.frame(), quoted=FALSE, func=NULL) {
|
||||
renderPrint <- function(expr, env = parent.frame(), quoted = FALSE, func = NULL,
|
||||
width = getOption('width')) {
|
||||
if (!is.null(func)) {
|
||||
shinyDeprecated(msg="renderPrint: argument 'func' is deprecated. Please use 'expr' instead.")
|
||||
} else {
|
||||
@@ -368,11 +369,9 @@ renderPrint <- function(expr, env=parent.frame(), quoted=FALSE, func=NULL) {
|
||||
}
|
||||
|
||||
markRenderFunction(verbatimTextOutput, function() {
|
||||
return(paste(capture.output({
|
||||
result <- withVisible(func())
|
||||
if (result$visible)
|
||||
print(result$value)
|
||||
}), collapse="\n"))
|
||||
op <- options(width = width)
|
||||
on.exit(options(op), add = TRUE)
|
||||
paste(capture.output(func()), collapse = "\n")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -606,7 +606,11 @@ dataTablesJSON <- function(data, req) {
|
||||
fdata <- data[i, , drop = FALSE] # filtered data
|
||||
} else fdata <- data
|
||||
fdata <- unname(as.matrix(fdata))
|
||||
# WAT: toJSON(list(x = matrix(nrow = 0, ncol = 1))) => {"x": } (#299)
|
||||
if (nrow(fdata) == 0) fdata <- list()
|
||||
# WAT: toJSON(list(x = matrix(1:2))) => {x: [ [1], [2] ]}, however,
|
||||
# toJSON(list(x = matrix(1))) => {x: [ 1 ]} (loss of dimension, #429)
|
||||
if (all(dim(fdata) == 1)) fdata <- list(list(fdata[1, 1]))
|
||||
|
||||
res <- toJSON(list(
|
||||
sEcho = as.integer(sEcho),
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
\alias{renderPrint}
|
||||
\title{Printable Output}
|
||||
\usage{
|
||||
renderPrint(expr, env = parent.frame(), quoted = FALSE, func = NULL)
|
||||
renderPrint(expr, env = parent.frame(), quoted = FALSE, func = NULL,
|
||||
width = getOption("width"))
|
||||
}
|
||||
\arguments{
|
||||
\item{expr}{An expression that may print output and/or return a printable R
|
||||
@@ -14,7 +15,9 @@ object.}
|
||||
\item{quoted}{Is \code{expr} a quoted expression (with \code{quote()})? This}
|
||||
|
||||
\item{func}{A function that may print output and/or return a printable R
|
||||
object (deprecated; use \code{expr} instead).}
|
||||
object (deprecated; use \code{expr} instead).}
|
||||
|
||||
\item{width}{The value for \code{\link{options}('width')}.}
|
||||
}
|
||||
\description{
|
||||
Makes a reactive version of the given function that captures any printed
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
}
|
||||
}
|
||||
\code{clientData} also contains information about each output.
|
||||
\code{output_\emph{outputId}_width} and \code{output_\emph{outputId}_height}
|
||||
\code{output_\var{outputId}_width} and \code{output_\var{outputId}_height}
|
||||
give the dimensions (using \code{offsetWidth} and \code{offsetHeight}) of
|
||||
the DOM element that is bound to \code{\emph{outputId}}, and
|
||||
\code{output_\emph{outputId}_hidden} is a logical that indicates whether
|
||||
the DOM element that is bound to \code{\var{outputId}}, and
|
||||
\code{output_\var{outputId}_hidden} is a logical that indicates whether
|
||||
the element is hidden. These values may be \code{NULL} if the output is
|
||||
not bound.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user