Module Server Return Value
Introduction
The module server returns a list of the references that are accessible outside the module.
# -- Module server return value
list(id,
url,
items,
data_model,
filtered_items,
selected_items,
clicked_column,
filter_date)
id
the id used to call the module (it’s also the id of the items and linked files)url
the url to the item file - it’s needed to call the save function whenautosave = FALSE
items
the data frame of the items (reference of thereactiveVal
)data_model
the data frame of the data model (reference of thereactiveVal
)filtered_items
the data frame of the filtered items (reference of thereactiveVal
)selected_items
a vector of itemid
(s) from the selected rows in the filtered view table (reference of thereactiveVal
)clicked_column
a numeric value, indicating which column of the filtered view has been clicked (reference of thereactiveVal
)filter_date
a numeric vector, with the value of the date slider input range (reference of thereactiveVal
)
All except id & url are references to reactive values that needs to be accessed in a reactive context.
Considerations
The magic with passing references is that the value itself is not copied or duplicated.1
The data model or items are not copied to the output, and it’s possible to access them from the outside of the module.
This communication strategy has been chosen over other method like passing a reactiveValues
object as argument to the module that will ‘feed’ it because it makes code less readable and more complex to implement.
It also allows to use the exported functions of the package from outside of the module server, which provides more flexible implementation options.