I am trying to define custom items in the contextMenu for rhandsontable in R, following the Handsontable documentation. However, I am encountering an error. Here's the code I have tried:
library(rhandsontable)
library(magrittr)
rhandsontable(iris) %>% hot_table(contextMenu = list(items = list('col_left', 'col_right')))
This code produces the following error:
Error in !is.null(contextMenu) && contextMenu :
invalid 'y' type in 'x && y'
I found a related GitHub issue that may provide some insight, but I am still unable to resolve the problem. How can I correctly define custom items in the contextMenu for rhandsontable?
Edit:
For context, I am using this script in Shiny. Perhaps we can directly manipulate the contextMenu via some javascript?
I don't have a mouse and the right-click does not work on my pad, so I can't try. I would try:
rhandsontable(iris, useTypes = FALSE) %>%
hot_context_menu(customOpts = list(items = list("col_left", "col_right")))
or
hot <- rhandsontable(iris, useTypes = FALSE)
hot$x$contextMenu = list(items = list("col_left", "col_right"))
My pad works sometimes, I have been able to check and the second code works.