https://github.com/jrowen/rhandsontable
A htmlwidgets implementation of Handsontable.js
https://github.com/jrowen/rhandsontable
handsontable htmlwidgets javascript r shiny sparkline
Last synced: 15 days ago
JSON representation
A htmlwidgets implementation of Handsontable.js
- Host: GitHub
- URL: https://github.com/jrowen/rhandsontable
- Owner: jrowen
- License: other
- Created: 2015-03-05T02:28:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-07-23T18:38:19.000Z (over 1 year ago)
- Last Synced: 2025-10-13T14:44:07.163Z (24 days ago)
- Topics: handsontable, htmlwidgets, javascript, r, shiny, sparkline
- Language: HTML
- Homepage: http://jrowen.github.io/rhandsontable/
- Size: 112 MB
- Stars: 390
- Watchers: 33
- Forks: 148
- Open Issues: 166
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - jrowen/rhandsontable - A htmlwidgets implementation of Handsontable.js (HTML)
- awesome-shiny-extensions - rhandsontable - Create Excel-like editable tables in Shiny apps. (UI Components / Table)
README
[](https://travis-ci.org/jrowen/rhandsontable)
[](https://ci.appveyor.com/project/jrowen/rhandsontable)
[](https://cran.r-project.org/package=rhandsontable)
[](https://cran.r-project.org/package=rhandsontable)
**See the [project website](https://jrowen.github.io/rhandsontable/) for more details and live examples, and see below for important details on use in shiny apps.**
An [`htmlwidgets`](https://www.htmlwidgets.org/) implementation of [Handsontable.js](https://handsontable.com). Per the website:
*Handsontable is a minimalist Excel-like data grid editor for HTML & JavaScript*
This library was inspired by the [`shinyTable`](https://github.com/trestletech/shinyTable) package. Most of the original functionality was preserved, and the `htmlwidgets` framework made it possible to leverage even more of the Handsontable.js functionality.
Note: With v7, `handsontable` went to a more [restrictive license for commercial use](https://github.com/handsontable/handsontable#license-key). To avoid license violations for existing users, `rhandsontable` will not update `handsontable` beyond v6.2.2. This may change in the future if a way is found to manage multiple `handsontable` versions.
**See the [vignette](https://rpubs.com/jrowen/intro_rhandsontable) for detailed examples and links to shiny apps.**
To install from CRAN use
```R
install.packages("rhandsontable")
```
For the latest development version use
```R
devtools::install_github("jrowen/rhandsontable")
```
A simple example
```R
library(rhandsontable)
DF = data.frame(int = 1:10,
numeric = rnorm(10),
logical = TRUE,
character = LETTERS[1:10],
fact = factor(letters[1:10]),
date = seq(from = Sys.Date(), by = "days", length.out = 10),
stringsAsFactors = FALSE)
# 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"))
```

A more involved `shiny` example
```R
shiny::runGitHub("rhandsontable", "jrowen", subdir = "inst/examples/rhandsontable_corr")
```
**Important note on shiny use:** The `htmlwidgets` package creates widgets as shiny output bindings. The `rhandsontable` package also attempts to expose the table as a *pseudo* shiny input binding using handsontable change events (see [here](https://github.com/jrowen/rhandsontable/blob/master/inst/htmlwidgets/rhandsontable.js) for the supported events). **This means the table (e.g. `hot`) can be accessed in shiny using either `input$hot` or `output$hot`, but these values may not be in-sync.** The timing of updates will depend on the particular reactive path followed by your shiny application.
Since the widget is not currently able to use the standard shiny input binding functionality, you will need to explicitly call the `hot_to_r` function to convert the handsontable data to an R object.
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.