DillonHammill / DataEditR

An Interactive R Package for Viewing, Entering Filtering and Editing Data
https://dillonhammill.github.io/DataEditR/
381 stars 40 forks source link

Exception if row add #4

Closed SatCat closed 3 years ago

SatCat commented 3 years ago

test my example, right click, and try add any rows.

mytb <- mtcars[1:10,1:2] mytb$colorcyl <- c("orange","green","red","blue", "black", "orange","green","red","blue", "black")[mytb$cyl] data_edit(mytb, col_options = list(colorcyl = c("red","blue","orange","green","black")))

Column editing is turned off to add dropdowns or checkboxes... Предупреждение: Error in seq.default: argument 'length.out' must be of length 1 80: stop 79: seq.default 77: genRowHeaders 76: 74: hot_to_r 73: observeEventHandler 2: runApp 1: data_edit

DillonHammill commented 3 years ago

@SatCat, after looking into this, I think that this is an issue with rhandsontable. I thought it may be due to the NA that is placed in the dropdown column when a new row is added, but this doesn't seem to be the case. In fact, if you try and do the same operation with a checkbox column this works as expected. I will look into the rhandsontable code when I get time, but in the meantime you may have to type this in manually if you wish to add rows.

DillonHammill commented 3 years ago

@SatCat, I have tracked down the issue to genRowHeaders in rhandsontable which is being invoked even when the number of rows is unchanged. This particular issue results from an afterChange event which does not contain a ct as required by the genRowHeaders code. I will need to look into this further to properly figure out why this is happening, in the meantime I have pushed a fix to my rhandsontable fork that should resolve this issue:

devtools::install_github("DillonHammill/rhandsontable")

I am just basically bypassing the genRowHeaders code if the event does not alter the number of rows in the data. You will also need the devel version of DataEditR for this to work:

devtools::install_github("DillonHammill/DataEditR", ref = "devel")