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

Reset data in table #75

Open
jaracklawrence opened this issue Jul 3, 2020 · 4 comments
Open

Reset data in table #75

jaracklawrence opened this issue Jul 3, 2020 · 4 comments
Labels
Feature Request New feature or request

Comments

@jaracklawrence
Copy link

I currently have a shiny app in which a selectinput allows users to choose a particular saved table, and i display that table using this excelR package (which is extremely useful). Users currently:

  1. Select a table from the drop down.
  2. Edit the table (which is a series of model inputs and parameters) using excelR as described in the documentation
  3. Click an action button to then run our model, reading data from the edited table (which is saved as a reactive value).

This all works fine in most cases.

However, in the case that the user:

  1. Selects a table,
  2. Edits it,
  3. Selects another table (but does not edit it),
  4. Clicks the run button
    Above the model will run using the table generated at step 2 - not the new one selected at step 3. Whilst the display will show the new table selected at step 3, it appears shiny doesn't update input$table unless an edit is made directly to it.

This is similar to if no edit is made at all. I see the documentation suggests the following:

        table_data <- excel_to_R(input$table)

        if(!is.null(table_data)){
            data_to_use <- table_data
        } 

I have modified this to the following for my purposes:

        table_data <- excel_to_R(input$table)

        if(is.null(table_data)){
            data_to_use <- original_table() #where original_table() is a reactive value of readRDS
        } else {
            data_to_use <- table_data
        }

Above it will simply assign the original table where no edits have been made to the excel table.

However, this still doesn't help if edits have been made, and then the selectinput chooses a different table.

In an ideal world there would be some solution that looks as follows:

Option 1: Another check in the logic described above and below

        table_data <- excel_to_R(input$table)

        if(is.null(table_data)){
            run_data <- original_table()
        } else if ( SOME CHECK GOES HERE ) {
            run_data <- original_table()
        } else {
            run_data <- table_data
        }

Option 2:

Some way of forcing excel_to_R(input$table) to reset to null every time the selectinput is used.

Many thanks,

I'm really enjoying this package.

@Swechhya
Copy link
Owner

Swechhya commented Jul 7, 2020

@jaracklawrence Currently the excel_to_R only returns data on any kind of onChange or onSelection event. I'll add a this as a todo feature.

@Swechhya Swechhya added the Feature Request New feature or request label Jul 7, 2020
@daeyoonlee
Copy link

Thank you for the great package !
I am currently using rHandsontable and DT but i am considering to change to excelR.
Currently excel_to_R function returns full data but I am interested about changed value(s) and table index only to speed up.
I would be very happy if it could be applied in the future.

@Swechhya
Copy link
Owner

Thanks @daeyoonlee. Will surely add it to the pipeline of todo features.

@daeyoonlee
Copy link

Thanks for your kind answer. I look forward to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants