Enabling/Disabling functionality from other modules

I'm building an application where we want to have a read/write toggle. This toggle would be on the main page. By default the application would be in "read-only" state where they can browse through the other pages (which have data, graphs etc visible) but buttons and functionality to upload and manipulate data is disabled. When the user toggles to "write-only", we want that functionality to be then enabled.

We're using shinyjs to disable the buttons at start up. What I was looking to do was to call a function that looped over all the UI elements across the different modules and called shinyjs::enable on them. E.g.:

toggler<- function(){
  items = c(
    NS("pgOne","uiElementOne"),
    NS("pgTwo","uiElementTwo"),
    NS("pgOne","uiElementTwo")
  )
  
  for(item in items){
    shinyjs::enable(id=item)
  }
}

I'm having no luck getting it working though, nor any other permutations of namespace etc. I'm not sure whether there's a namespace issue, or similar, or if I'm just barking up the wrong tree. Any help is very appreciated though.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.