Skip to content

Cll test #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions global.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ library(DTedit)
library(psrc.travelsurvey)
library(shinyjs)


df <- data.frame(
Buy = c('Tea', 'Biscuits', 'Apples'),
Quantity = c(7, 2, 5),
stringsAsFactors = FALSE
)

# Run Modules Files ---------------------------------------------------------------------------
# This section runs the modules and unless the folder name changes, it doesn't need to be changed
# It also loads in useful functions for dashboard creation
Expand Down
31 changes: 12 additions & 19 deletions modules/transit-region.R
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
transit_region_ui <- function(id) {
ns <- NS(id)

tagList(
uiOutput(ns("transitregion"))
)
uiOutput(ns(id))

}

transit_region_server <- function(id) {
transit_region_server <- function(id, mydata) {

moduleServer(id, function(input, output, session){
ns <- session$ns

output$edit_table <- dtedit(input, output,
# name = id,
name = "edit_table",
thedata = data.frame(
Buy = c('Tea', 'Biscuits', 'Apples'),
Quantity = c(7, 2, 5),
stringsAsFactors = FALSE
))

output$transitregion <- renderUI({
tagList(
fluidRow(column(12,uiOutput(ns("edit_table")))),
hr(style = "border-top: 1px solid #000000;")
)
})
return(
dtedit(input = input,
output = output,
name = id,
id = id,
thedata = mydata)
)


}) # end moduleServer
}
9 changes: 8 additions & 1 deletion server.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ shinyServer(function(input, output) {
transit_overview_server('OVERVIEWtransit')

# Regional NTD metrics
transit_region_server('REGIONtransit')
## Option A: the module below is how to place dtedit inside a module ----
transit_region_server('REGIONtransit', mydata = df)

## Option B: "dtedit_server" is already a module, straight from the DTedit package. "df" is defined in global.R ----
dtedit_server(id = 'dtedit_example',
thedata = df,
edit.cols = names(df),
edit.label.cols = names(df))

# Regional NTD metrics by Mode
transit_mode_server('MODEtransit')
Expand Down
8 changes: 7 additions & 1 deletion ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ shinyUI(
fluidRow(column(12, style='padding-left:25px; padding-right:50px;',
tabsetPanel(type = "pills",
tabPanel("Overview", transit_overview_ui('OVERVIEWtransit')),
tabPanel("Mode Error", transit_region_ui('REGIONtransit')),

## Option B: "dtedit_ui" is already a module, straight from DTedit package ----
tabPanel("Mode Error", dtedit_ui('dtedit_example')),

## Option A: the module below is how to place dtedit inside a module ----
tabPanel("Mode Error 2", transit_region_ui('REGIONtransit')),

tabPanel("PUDO, no +/- traveler", transit_mode_ui('MODEtransit')))
)),

Expand Down