According to documentation:
Note: As of Shiny 1.5.0, we recommend using moduleServer() instead of callModule(), because the syntax is a little easier to understand, and modules created with moduleServer can be tested with testServer().
But here is the docs for callModule:
Usage
callModule(module, id, ..., session = getDefaultReactiveDomain())Arguments
- module A Shiny module server function
- id An ID string that corresponds with the ID used to call the module's UI function
- ... Additional parameters to pass to module server function
- session Session from which to make a child scope (the default should almost always be used)
And here is the docs for moduleServer:
Usage
moduleServer(id, module, session = getDefaultReactiveDomain())Arguments
- id An ID string that corresponds with the ID used to call the module's UI function.
- module A Shiny module server function.
- session Session from which to make a child scope (the default should almost always be used).
How do I add additional parameters to the server function without the ...?
CodePudding user response:
moduleServer will live inside the server-side portion of the module you create. It contains only the id and the module itself. The employeeInfoServer passes id as well as employee_. This could pass any number of additional arguments such as function(id, employee_, hair_color, eye_color, city) etc... Those variable are then accessible in the moduleServer
employeeInfoServer <- function(id, employee_) {
moduleServer(
id,
function(input, output, session) {
output$job_title<- renderUI({
h3(users[match(employee_, users$Name), "Job Title"])
})
}
)
}
...maybe this makes more sense. yourmoduleServer is the server-side of the module you're creating.
yourmoduleServer <- function(id, ...) {
moduleServer(id, module)
}
