Hi!
I have a complex modular app in Rshiny where I use ns() in my differents modules.
I have a part where I have to create my inputId directly in my javascript code with "setInputValue". I do a test with a function who prints a random value.
Shiny.setInputValue("testrandom", Math.random());
I do some test without modules so without ns() and it's working.
In the Shiny App with this code:
observeEvent( input$testrandom , {
print(input$testrandom)
})
So the problem is the idInput.
It seems to not be created because I don't have the ns().
So I tried to do some soluce I found on stackOverflow or here but nothing worked.
Test 1 : Shiny.setInputValue(ns("testrandom"), Math.random());
Test 2 : Shiny.setInputValue("namespace-testrandom", Math.random());
source: Shiny.setInputValue in modular app with namespaces
Test 3 : Shiny.setInputValue(NS("explore_module-image", id= "testrandom"), Math.random());
Test 4 : Shiny.setInputValue(ns("explore_module-image"), id="testrandom", Math.random());
I test a lot of different methods but nothing work.
For the test 3 and 4 the "explore_module-image" is the way with my different ns of my app. I concatenate my both ns id because I thought that each ns use are concatenated to form a path?
-> The first module is called with the id "explore_module"
callModule(Module_explore_server, "explore_module", global_data)})
and in this module I call another module with an id ns "image"
callModule(explore_image_server, "image", rv)
and in this module I use the code I write before with the observeEvent.
So I thought that I could give all the pass of ns "explore_module-image" but it's not working.
I would like to ask if anyone have a solution or understand my error ?
Thank you!