From 6c1c2dc5f484c5fbe7590f1bc6a71a622b252f3e Mon Sep 17 00:00:00 2001 From: Thomas Shafer Date: Sun, 23 Jun 2019 16:46:53 -0700 Subject: [PATCH] Address changes to Handsontable Support licenseKey for new license model of Handsontable Address height and width issue with new Handsontable Handsontable version 7.0.0 changes the license model. https://github.com/handsontable/handsontable/releases/tag/7.0.0 --- R/rhandsontable.R | 4 +++- inst/htmlwidgets/rhandsontable.js | 7 +++++++ man/rhandsontable.Rd | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/R/rhandsontable.R b/R/rhandsontable.R index ba7076a..edd0c08 100644 --- a/R/rhandsontable.R +++ b/R/rhandsontable.R @@ -8,6 +8,7 @@ #' will be used. Setting to \code{NULL} will omit. #' @param rowHeaders a vector of row names. If missing \code{rownames} #' will be used. Setting to \code{NULL} will omit. +#' @param licenseKey the license key to pass to Handsontable #' @param comments matrix or data.frame of comments; NA values are ignored #' @param useTypes logical specifying whether column classes should be mapped to #' equivalent Javascript types. Note that @@ -34,7 +35,7 @@ #' rhandsontable(DF, rowHeaders = NULL) #' @seealso \code{\link{hot_table}}, \code{\link{hot_cols}}, \code{\link{hot_rows}}, \code{\link{hot_cell}} #' @export -rhandsontable <- function(data, colHeaders, rowHeaders, comments = NULL, +rhandsontable <- function(data, colHeaders, rowHeaders, licenseKey = NULL, comments = NULL, useTypes = TRUE, readOnly = NULL, selectCallback = FALSE, width = NULL, height = NULL, digits = 4, @@ -128,6 +129,7 @@ rhandsontable <- function(data, colHeaders, rowHeaders, comments = NULL, columns = cols, width = width, height = height, + licenseKey = licenseKey, debug = ifelse(is.null(debug) || is.na(debug) || !is.numeric(debug), 0, debug), search = search ) diff --git a/inst/htmlwidgets/rhandsontable.js b/inst/htmlwidgets/rhandsontable.js index 754cc79..6fd3ace 100644 --- a/inst/htmlwidgets/rhandsontable.js +++ b/inst/htmlwidgets/rhandsontable.js @@ -42,6 +42,13 @@ HTMLWidgets.widget({ //this.afterRender(x); + if (x.height == null) { + x.height = 'auto'; + } + if (x.width == null) { + x.width = 'auto'; + } + this.params = x; if (instance.hot) { // update existing instance diff --git a/man/rhandsontable.Rd b/man/rhandsontable.Rd index 3137842..43441e9 100644 --- a/man/rhandsontable.Rd +++ b/man/rhandsontable.Rd @@ -4,7 +4,7 @@ \alias{rhandsontable} \title{Handsontable widget} \usage{ -rhandsontable(data, colHeaders, rowHeaders, comments = NULL, +rhandsontable(data, colHeaders, rowHeaders, licenseKey = NULL, comments = NULL, useTypes = TRUE, readOnly = NULL, selectCallback = FALSE, width = NULL, height = NULL, digits = 4, debug = NULL, search = FALSE, ...) @@ -18,6 +18,8 @@ will be used. Setting to \code{NULL} will omit.} \item{rowHeaders}{a vector of row names. If missing \code{rownames} will be used. Setting to \code{NULL} will omit.} +\item{licenseKey}{the license key to pass to Handsontable} + \item{comments}{matrix or data.frame of comments; NA values are ignored} \item{useTypes}{logical specifying whether column classes should be mapped to