You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Irzam Sarfraz edited this page Aug 24, 2022
·
3 revisions
Introduction to modules
Why use modules?
Issues with large applications
Code complexity (single file & too much code)
Reusability
Need separate identifiers (namespace)
Create functions that dynamically generate user-interface & server code
Modules help
Small units
Separate user-interface and server code
Call multiple times like a function
Separate namespace for each called instance of the module
Example of a module in SCTK
filterTable module
Input
Dataframe
Actions
UI for the input dataframe is setup (table)
UI for filters populated corresponding to the columns of the input dataframe
Server code setup for actions taken on the table & filters
Output
Selected rows of the table
How to use shiny modules? (add figures from presentation)
Create module R file
a. Module UI
b. Module Server
Source module R file in your application
Call module UI in your application UI (assign ID)
Call module server code in your application server (use same ID)
Communicating between modules
Different instances of same module
Different modules