marineenergy / apps

shiny apps for marineenergy.app
https://marineenergy.github.io/apps/
MIT License
3 stars 1 forks source link

Handle hierarchical project > doc > section & url in Edit app (+ read/write Google Sheet) #49

Open bbest opened 3 years ago

bbest commented 3 years ago

Transfer:

cdobbelaere commented 3 years ago

Hi @bbest, it looks like I need access to the data | marineenergy.app - Google Sheet - either cdobbelaere@ucsb.edu or cristinadobbelaere@gmail.com should work. Thanks!

Screen Shot 2021-09-09 at 2 44 36 PM
bbest commented 3 years ago

Ah whoops, I should've done that already. Ok, just gave you access :)

cdobbelaere commented 3 years ago

No worries, just got it! @bbest

bbest commented 3 years ago

Ok, looks like you got this to work well in Google Sheets but the multiple levels of hierarchy seem too complicated to handle with its data validation:

Ideally, something like Access subdatasheet would be available in Shiny DT::datatable(), eg Access 2016 Tables: Subdatasheets - YouTube @ 8:20:

image

But here's what we found:

bbest commented 3 years ago

This solution seems to work :) Manually edit child row in shiny datatable - Stack Overflow:

image

See DTedit-subdatasheet/test.R

bbest commented 3 years ago

Hi @cdobbelaere, here also is a more thorough explanation of this NestedData() approach:

cdobbelaere commented 3 years ago

Thanks @bbest! Very helpful.

bbest commented 3 years ago

Actually @cdobbelaere, I'm thinking we could handle all of this more simply with selectizeInput(..., create = T) inside a renderUI() and some observe() functions to detect a new list item plus updateSelectizeInput(). See: Shiny - Using selectize input:

# allow creation of new items in the drop-down list
selectizeInput(
  'foo', label = NULL, choices = state.name,
  options = list(create = TRUE)
)
cdobbelaere commented 3 years ago

@bbest - Sounds like a good plan of action - will look into it right now.

Are we thinking that we'd update the project choices (via create = TRUE) for the DTedit ferc docs table as a whole, or would this be for a separate tab with the docs/sections/URLs corresponding to each project?

I was initially using this approach for updating the project choices for the DTedit ferc docs table, but the selectizeInput() and selectize.options didn't seem to be working (they were from the DavidPatShuiFong modularized version of DTedit), similarly to how we were having difficulties adding in checkboxInputs.

cdobbelaere commented 3 years ago

Hi @bbest, exciting news!! I was finally able to get the correct DavidPatShuiFong version of DTedit installed, and we now have checkboxInputs functioning! Now to see if we can get the selectize.options from this particular commit in order.

cdobbelaere commented 3 years ago

Screenshots showing

  1. checkboxInput functionality

    Screen Shot 2021-09-13 at 4 02 23 PM
  2. ability to create a new project within edit panel

    Screen Shot 2021-09-13 at 4 02 43 PM
bbest commented 3 years ago

We can use update.R's update_ferc_docs() and update the GoogleSheet data | marineenergy.app - Google Sheets with googlesheets4::sheet_write().