I found the bsModal works as expected with fluidPage but not without it. Just click "View Table" button to see the difference.
The version with fluidPage:
library(shiny)
library(shinyBS)
shinyApp(
ui =
fluidPage(
sidebarLayout(
sidebarPanel(
actionButton("tabBut", "View Table")
),
mainPanel(
bsModal("modalExample", "Data Table", "tabBut", size = "large",
"distTable")
)
)
),
server =
function(input, output, session) {}
)
The version without fluidPage, the only change is that the fluidPage is replaced by tagList:
library(shiny)
library(shinyBS)
shinyApp(
ui =
tagList(
sidebarLayout(
sidebarPanel(
actionButton("tabBut", "View Table")
),
mainPanel(
bsModal("modalExample", "Data Table", "tabBut", size = "large",
"distTable")
)
)
),
server =
function(input, output, session) {}
)
Can anyboday help me explain what happened between bsModal and fluidPage?
Because fluidPage
is much, much more than a simple tagList
.
tagList
simply takes it arguments and concatenates them (expecting each argument to be some sort of HTML tag). fluidPage
literally generates an entire HTML document with bootstrap dependencies.
Your first example is figuratively "build a house with basement, floor plan and attic" with sidebarLayout
explaining the layout of floors and fluidPage
being the house. Remove the fluidPage
and you're trying to build a house with basement, floor plan and attic, but without the foundation, walls or roof.