R/shiny.r

Defines functions jsonviewOutput renderJsonview

Documented in jsonviewOutput renderJsonview

#' Widget output function for use in Shiny
#'
#' @param outputId outputId
#' @param width width
#' @param height height
#' @export
jsonviewOutput <- function(outputId, width = '100%', height = '400px'){
  htmlwidgets::shinyWidgetOutput(outputId, 'jsonview', width, height,
                                 package = 'jsonview')
}

#' Widget render function for use in Shiny
#'
#' @param expr expr
#' @param env env
#' @param quoted quoted
#' @export
renderJsonview <- function(expr, env = parent.frame(), quoted = FALSE) {
  if (!quoted) { expr <- substitute(expr) } # force quoted
  htmlwidgets::shinyRenderWidget(expr, jsonviewOutput, env, quoted = TRUE)
}
hrbrmstr/jsonview documentation built on May 17, 2019, 5:10 p.m.