rhandsontable
rhandsontable copied to clipboard
Pasting data that would add columns to handsontable fails
Pasting data into a handsontable so that the pasting adds new columns seems broken. I am using the latest version 0.3.6.1, but I also had the problem in older versions.
How to reproduce:
Create a handsontable like this:
rhandsontable(
iris,
readOnly = FALSE,
useTypes = FALSE,
colHeaders = NULL
)
Select several columns, copy and paste them into the rightmost column.
I am using this in a shiny app, where I end up with the following error:
Error in genColHeaders(changes, colHeaders): Change no recognized:afterChange
. If I launch rhandsontable from the console with the code above, i just get wonky pasting behaviour.
edit: I forgott to mention that the error occurs when I call hot_to_r()
on the rhandsontable object, not before.
I'm not able to reproduce this issue with the latest version of the library. If I create a new rhandsontable
using the code about, I can right-click, choose add a column on the left/right and then paste in data.
If you are still running into the issue, could you please include a complete example?
It occurs only when several new columns would be added to the table due to pasting:
rhandsontable(
iris,
readOnly = FALSE,
useTypes = FALSE,
colHeaders = NULL
)
- run the code example above
- select a few rows from the first 4 columns, ctrl+c copy
- put the curser in the rightmost column (species)
- ctrl+v paste
expected behaviour
A few rows in the species column are overwritten with the pasted data, and 3 new columns are added to the table, containing the copied data.
what actually happens
a single empty column gets added to the table
Can you reproduce this? In the shiny app i am developing it also leads to a broken content for hot_to_r()
. I will try to put together also a reprex for that, but give me one or two weeks please.
Here is a reproducible shiny app example. Just try the procedure outlined above and the app will crash with Warning: Error in genColHeaders: Change no recognized:afterChange
library(rhandsontable)
library(shiny)
shinyApp(
ui = fluidPage(
shiny::mainPanel(
rHandsontableOutput("hot")
)
),
server = function(input, output, session){
output$hot <- renderRHandsontable(rhandsontable(iris[1:5, ], useTypes = FALSE))
observeEvent(input$hot, {
print(hot_to_r(input$hot))
})
}
)
without the observeEvent(...)
it works as expected
Having the same issue. @s-fleck did you manage to solve this?
Nope no progress on this one :(
having similar issue - with the same setup as above, simply inserting a column and typing some data in it, then calling hot_to_r is enough to cause crash with same error message.
Just wanted to share that I encountered the same error message too.
In my case, the problem was that my table has a column where each element is a list of strings. I had to flatten those lists and convert them into one string in order for hot_to_r()
to not throw the error.
I also ran into this error.
In my case, the problem was a column that only had NULL values. Changing NULL to empty strings solved the problem.