Skip to content

Commit

Permalink
Address changes to Handsontable
Browse files Browse the repository at this point in the history
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
  • Loading branch information
trshafer committed Aug 9, 2019
1 parent 369fa80 commit 06f0c27
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 3 deletions.
4 changes: 3 additions & 1 deletion R/rhandsontable.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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
)
Expand Down
60 changes: 59 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
```
Expand All @@ -54,3 +54,61 @@ 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.

<table>
<thead align="center">
<tr>
<th width="50%">Free license</th>
<th width="50%">Paid license</th>
</tr>
</thead>
<tbody align="center">
<tr>
<td>For non-commercial purposes such as teaching, academic research, personal experimentation, and evaluating on development and testing servers.</td>
<td>For all commercial purposes</td>
</tr>
<tr>
<td>All features are available</td>
<td>All features are available</td>
</tr>
<tr>
<td>Community support</td>
<td>Dedicated support</td>
</tr>
<tr>
<td><a href="//github.com/handsontable/handsontable/blob/master/handsontable-non-commercial-license.pdf">Read the license</a></td>
<td><a href="//handsontable.com/pricing">See plans</a></td>
</tr>
</tbody>
</table>

### 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'
)
```

### Using a previous version.

If you would like to continue to use handsontable `6.1.1`, which is released under MIT license, please install rhandsontable using instructions from [github install](https://cran.r-project.org/web/packages/githubinstall/vignettes/githubinstall.html).

```R
library(devtools)
install_github("jrowen/rhandsontable", ref = "v0.3.7")
library(rhandsontable)
```
7 changes: 7 additions & 0 deletions inst/htmlwidgets/rhandsontable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion man/rhandsontable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 06f0c27

Please sign in to comment.