How to use modular function inside RenderUI

shiny

#1

I am trying to use a shiny module based on certain conditions. into another UI. I tried this method. However the code is not important but it's fairly a simple one.

library(shiny)

source('www/Modules/CRUD_db.R')
source('www/Modules/mod_SQL_functions.R')
                
ui <- fluidPage(
  
    uiOutput('some')
    
)

server <- function(input, output, session) {
  
    sqlite<-reactive({
        dbConnect(SQLite(),
                  'www/main_data.sqlite')
    })
    
output$some<-renderUI(
    mod_crud_ui("FUB")
)    

callModule(mod_crud_serve,'user',sqlite())

}

shinyApp(ui, server)

But I get only the First part of the Module which is not reactive. I mean which is not dependent on anything else. This is how it looks

But it should look something like this

Where the right panel is based on the radio button if you change it it will change the panel like this

All I want to know is if I can user ModelUI function to generate UI in renderUI code on the server. If yes how if no how should I proceed to Make the module conditional


#2

I tried it using other module and the result is still the same

When I use it with module normally it works fine


library(shiny)

source('www/Modules/Main_app.R')

ui <- 
    main_ui('some')
    # uiOutput('test')


server <- function(input, output, session) {

callModule(main_server,'some')  
    
    
# output$test<-renderUI(main_ui('some'))    
}

shinyApp(ui, server)

But when I try to render the module function through RenderUI it fails. It doesn't produce any error but it gives me a blank screen. I think there is something wrong with the namespaces that I Don't understand please help me out if you have any information or any resources.

This is the code

library(shiny)

source('www/Modules/Main_app.R')

ui <- 
    # main_ui('some')
     uiOutput('test')


server <- function(input, output, session) {

callModule(main_server,'some')  
    
    
output$test<-renderUI(main_ui('some'))    
}

shinyApp(ui, server)

and this is the screenshot

I am sure there must be some trick that I am not able to catch please help me out or point me onto any direction.


#3

Does anybody have any solution to this problem I kinda need it urgently. Please if you have any suggestion I willing to try it.

You can get the entire project from github

It has a main_app module inside www/modules.

this is the module I am trying to call. Please do reply.


#5

You can not render shinydashboard through renderUI

that's the problem I was facing. Now i have to rewrite the app without dashboard.