Reputation: 2394
ui.r
shinyUI(
fluidPage(
titlePanel("the title"),
mainPanel(
tabsetPanel(tabPanel("Raw Data",verbatimTextOutput("theText")),
tabPanel("Raw Data2",verbatimTextOutput("theText"))
)
)
)
)
server.r
library("shiny")
library("dplyr")
shinyServer(
function(input, output,session) {
print("do it")
output$theText <- renderText({
return("please work")})
}
)
If I remove one tabPanel it works, and "do it" is printed in the console and the title and "please work" is printed in the UI. Otherwise, with both, the UI with two tabs shows up and nothing is printed or displayed within the tabs, though an empty grey box does show up.
Using RStudio 0.99.332, R 3.1.2, shiny 0.11.1
Upvotes: 0
Views: 793
Reputation: 2486
In rshiny one output can go only to one place, which means that you have to create new output for other tabPanel.
library(shiny)
server <- function(input, output, session) {
print("do it")
output$theText <- renderText({
return("please work")})
output$theText2 <- renderText({
return("please work")})
}
ui <- fluidPage(
titlePanel("the title"),
mainPanel(
tabsetPanel(tabPanel("Raw Data",verbatimTextOutput("theText")),
tabPanel("Raw Data2",verbatimTextOutput("theText2"))
)
)
)
shinyApp(ui = ui, server = server)
Upvotes: 2