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/README.md b/README.md index a709c27..5ecaa1d 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ DF = data.frame(int = 1:10, # add a sparkline chart DF$chart = sapply(1:10, function(x) jsonlite::toJSON(list(values=rnorm(10)))) - + rhandsontable(DF, rowHeaders = NULL) %>% hot_col("chart", renderer = htmlwidgets::JS("renderSparkline")) ``` @@ -54,3 +54,51 @@ Since the widget is not currently able to use the standard shiny input binding f Two additional inputs are also enabled, `input$hot_select` and `input$hot_comment`, which will fire when a cell selection or a comment changes, respectively (if you would like to see more options, please post an issue or create a PR). This functionality is still evolving, so please don't hesitate to share suggestions and PRs. + +## License + +This wrapper is released under [the MIT license](//github.com/jrowen/rhandsontable/blob/master/LICENSE) but under the hood it uses [Handsontable](//github.com/handsontable/handsontable), which is dual-licensed. You can either use it for free in all your non-commercial projects or purchase a commercial license. + + + + + + + + + + + + + + + + + + + + + + + + + + +
Free licensePaid license
For non-commercial purposes such as teaching, academic research, personal experimentation, and evaluating on development and testing servers.For all commercial purposes
All features are availableAll features are available
Community supportDedicated support
Read the licenseSee plans
+ +## License key + +**The license key is obligatory since [Handsontable 7.0.0](//github.com/handsontable/handsontable/releases/tag/7.0.0) (released in March 2019).** + +If you use Handsontable for purposes not intended toward monetary compensation such as, but not limited to, teaching, academic research, evaluation, testing and experimentation, pass a phrase `'non-commercial-and-evaluation'`, as presented below. + +You can pass it in the `rhandsontable` function: + +```R +rhandsontable( + data = data, + colHeaders = colHeaders, + rowHeaders = rowHeaders, + licenseKey = 'non-commercial-and-evaluation' +) +``` 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