0

I have just gotten into modules and it seems like I have not figured it out yet. The following code does not run properly. The app closes immediately after it opens.

It seems like the id does not match. However, I am not quite sure what goes wrong.

I set up input and output for the UI in the module and then set up the server for the module. I then combine everything in the UI and Server for the app and run it.

SharePrepayInputUI<- function(id, vChoice){
  ns <- NS(id)
          tagList(
            fluidRow(
              column(2,
                  pickerInput(ns("navn"),"Select Segment", choices=vChoice, options = list(
                    "actions-box" = TRUE, 
                    "live-search" = TRUE), 
                    multiple = TRUE))
            )
  )
}

ShareOutpuitUI <- function(id){
  ns <- NS(id)
  
  tagList(
    fluidRow(
      column(6,
             dataTableOutput(ns("cls"))),
      column(4,
             dataTableOutput(ns("dbl")))
    )
  )
}

ShareServer <- function(id){
  moduleServer(id, function(input, output, session){
    
    # Table for cash loan share
    
    output$cls <- renderDataTable({
        DT::datatable(mCls[mCls$Segment %in% input$navn,], container = sketch_cls, rownames = FALSE)
    })
    
    output$dbl <- renderDataTable({
      DT:datatable(mDbl[mDbl$Segment %in% input$navn,], container = sketch_dbl, rownmaes = FALSE)
    })
  })
}

UdtrDebUI <- fluidPage(
  SharePrepayInputUI(id = "module_1", vChoice = mCls$Segment),
  ShareOutpuitUI(id = "module_1")
)

UdtrDebServer <- function(id){
  ShareServer(id = "module_1")
}

shinyApp(UdtrDebUI, UdtrDebServer)
  • 2
    Try `UdtrDebServer <- function(input, output, session)`. You have set up the (main) server function as if it is a module server. – stefan Oct 26 '22 at 06:11

0 Answers0