-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I'm having trouble getting a shiny module to display the dqshiny handsontable. I think it is a namespace issue, but really, I have no idea. The table data does not display in the module example below. I also include an example of the code working when not using modules.
Nonworking code example using module:
library(shiny)
library(rhandsontable)
library(dqshiny)
# module UI ->
myModuleUI <- function(id) {
ns <- NS(id)
tagList(
fluidRow(
dq_handsontable_output(ns("dataTable"))
)
)
}
# module server ->
myModule <- function(input, output, session, df) {
dq_render_handsontable("dataTable", df)
}
# Use the module in an application
ui <- fluidPage(
myModuleUI("myModule1")
)
server <- function(input, output, session) {
df = data.frame(
company = c('a', 'b', 'c', 'd'),
bond = c(0.2, 1, 0.3, 0),
equity = c(0.7, 0, 0.5, 1),
cash = c(0.1, 0, 0.2, 0),
stringsAsFactors = FALSE
)
callModule(myModule, "myModule1", df = df)
}
shinyApp(ui, server)
The code below works without using modules:
shinyApp(
ui = fluidPage(
dq_handsontable_output("dataTable")
),
server = function(input, output, session) {
df = data.frame(
company = c('a', 'b', 'c', 'd'),
bond = c(0.2, 1, 0.3, 0),
equity = c(0.7, 0, 0.5, 1),
cash = c(0.1, 0, 0.2, 0),
stringsAsFactors = FALSE
)
dq_render_handsontable("dataTable", df)
}
)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels