Appsilon / reactable.extras

Extra features for reactable package
https://appsilon.github.io/reactable.extras/
41 stars 4 forks source link

Is it possible to save the state of the user-modified reactable to a data frame (or file) [Feature]: #47

Open chrisumphlett opened 11 months ago

chrisumphlett commented 11 months ago

Guidelines

Description

I'm using rhandsontable to allow end users to update values of a table in a shiny app, and then save it to a file. But the UX is terrible, when deployed to Posit Connect (other users have reported this on its GH). I had to replace a nice reactable with that. I'm hoping I can have both the aesthetics and functionality of reactable with the ability to modify and save.

Problem

Wanting a user to update info and have it persist to the next time they access it (by saving it somewhere and using that to update the source data).

Proposed Solution

I don't know if this is possible currently or not. An out of the box function would be used by many people I think, but if I can do something manually now I'd like to (and/or I can help contribute to this development).

Alternatives Considered

rhandsontable is the only package I've found to do this, it has a glitchy UI when deployed to a server and it has not been updated for a long time.

chrisumphlett commented 11 months ago

A not very good, but possible workaround. Write out output$text to a file and then parse that.

I modified the custom inputs sample code like this:

output$text <- renderText({
      req(input$text)
      message(getwd())
      sink("reactable_extras.log", append = TRUE)
      values <- input$text
      print(paste0(
        "Text: ",
        string_list(values)
      ))
      sink()
    })

Then, as I make changes in the text column, each change in character is logged. image

I could take the last row for each distinct row : N... column : X group and try and use that to go back and update the source data. The effort it would take for me to do this is probably prohibitive, given the likely shaky outcome (at best). I would have significant downstream work to do as well, because my current process saves a file to Azure blob storage, then uses Azure data factory to upsert that file to a database.

fabrizioTerrAria commented 3 weeks ago

Hi @chrisumphlett, this would be a very usefull feature. Did you find a solution for your problem ? Thank you very much. Fabrizio

chrisumphlett commented 3 weeks ago

No. Admittedly, I haven't tried. I watched a portion of a webinar from Posit about using the DT package. Before trying with reactable I had implemented with rhandsontable I believe it was called. Very buggy when deployed to Posit Connect though it worked fine locally (Shiny app). That package hadn't been updated for years.