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

R shiny DT table with pagination and drop down list inside table and being able to save the entire updated table as csv file #1107

Closed
2 of 3 tasks
sound118 opened this issue Dec 23, 2023 · 5 comments

Comments

@sound118
Copy link

sound118 commented Dec 23, 2023

Hi,

I have been experimenting with R shiny DT table with pagination and drop down list inside table and being able to save the entire updated table as csv file. It seems when I have pagination = FALSE, it can work as expected. However, in many use cases, we do need pagination = TRUE. I am referring to this stackoverflow page which works for pagination = FALSE. link: https://stackoverflow.com/questions/75948475/value-not-updated-in-shiny-using-dt-and-drop-down-selection/77706843#77706843
Can anyone help to improve it to be able to save the entire updated data table as csv file with pagination = TRUE?

Thanks


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('DT'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/DT').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@stla
Copy link
Collaborator

stla commented Dec 26, 2023

Search "cellEdit" in my StackOverflow answers within the [dt] tag, e.g. this answer.

@sound118
Copy link
Author

I checked your stackoverflow page. Actually this is not quite what I want. What I want is drop down list inside data table with fixed choices, not simply editting cells. I actually have some testing R shiny code here, but there's problem with it. The issue is when I click into other pages other than first page and select a choice from drop down list, it always goes back to first page. The code and the base csv file are in attached files, could you pls help to fix this? Many thanks!

@sound118
Copy link
Author

saved_data.csv
app_dropdown.txt
Please use above two files to run my testing r shiny app!

@kit-hcrn
Copy link

Make sure you use server = FALSE in RenderDataTable. DT only loads the current page to the browser when using server = TRUE.

@sound118
Copy link
Author

I resolved this issue by adding isolate function around rv$data in datatable function call.

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

3 participants