Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: allow edited table to be sent back to shiny (not just the cell that was edited) #521

Closed
daattali opened this issue Mar 29, 2018 · 7 comments
Milestone

Comments

@daattali
Copy link

I realize this can be done by keeping the data as a reactive value and updating it manually. But I think it'd be a great addition to the edit feature if the current state of the table was synchronized between server and client. If the risk is performance issues, then perhaps it could be off by default but a parameter can be set to allow the table to be sent to shiny every time a change is made.

@yihui
Copy link
Member

yihui commented Mar 29, 2018

I don't quite understand what you meant by the "edited table" in the subject. What exactly do you expect DT to do after a cell is edited? Currently it gives you input$tableID_cell_edit. It may be clearer to talk with an example (like example 3 in #480).

@daattali
Copy link
Author

I meant having something similar to what rhandsontable does, where you can always get a reference to the current state of the table.

If I create a table output, and the user clicks on cell and edits it, it'd be useful if shiny was passed the new value of the table. Having the information about the exact cell that was edited (as is currently done) is also useful obviously, but there are many usecases where it'd be easier to have DT handle giving me back the modified table instead of the shiny developer having to manually change a dataframe entry using the currently available information.

Similar to rhandsontable's input$hot https://jrowen.github.io/rhandsontable/#shiny

@yihui
Copy link
Member

yihui commented Mar 30, 2018

Manually changing the data frame (x[i, j] <- new_value) does not sound too complicated to me. On the other hand, passing the modified data frame from JavaScript to R's input$new_data_frame sounds very, very inefficient to me (and not trivial to implement correctly because conversion of a data frame between R and JSON can be lossy).

@daattali
Copy link
Author

You're right it's not complicated, just thought it'd be a convenient feature because I've seen people attempt to do that many times, so it could be nice to have it supported natively. But I do understand it can be tricky to implement correctly

@nschwamm
Copy link

I would like to re-up this thread. I think an important implication of getting the whole table is when dealing with reactive elements. Let's say you have a reactive table x rather than a fixed table x, how can you continue to use the persisted values of the edited table?

@pyocote
Copy link

pyocote commented Apr 4, 2019

Do we have to get "all " the cells updated and then update the dataframe?
How do we do so?

@yihui
Copy link
Member

yihui commented Apr 5, 2019

You can edit the whole table now. See #493 (comment). However, if you are using the server-side processing mode, you have to understand that only one page of the data is available on the client side (i.e. in the web browser), so you can only edit that page. For the client-side processing mode, you can edit the full table. See the examples mentioned in NEWS.md.

@yihui yihui added this to the v0.6 milestone Apr 5, 2019
@yihui yihui closed this as completed Apr 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants