r - 在闪亮的应用程序中更改选项卡面板中的下载按钮位置
问题描述
我正在开发一个闪亮的应用程序并使用mainPanel()
带有选项卡面板的。第一个tabPanel()
应该包含 atableOutput()
和 a downloadButton()
。downloadButton()
如下图所示对齐。
只有当输出表产生时,它才会下降。我希望它从一开始就与表格底部对齐。我应该在我的代码中更改什么?
这是代码:
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
selectizeInput(inputId = "gender1",
label = "Choose samples to compare",
choices = genders,
options = list(
placeholder = 'Sample 1',
onInitialize = I('function() { this.setValue(""); }'))),
conditionalPanel("input.gender1 != ''",
selectizeInput(inputId = "gender2",
label = NULL,
choices = '',
options = list(
placeholder = 'Sample 2',
onInitialize = I('function() { this.setValue(""); }')))),
actionButton(inputId = "button", label = "Plot",
style="color: #fff; background-color: #337ab7; border-color: #2e6da4"))),
mainPanel(
tabsetPanel(
tabPanel("Table", tableOutput("table"),
downloadButton("download", "Download",
style="color: #fff; background-color: green; border-color: Black;")),
tabPanel("Volcano Plot", plotOutput("vplot",width = "550px", height="350px")),
tabPanel("PCA Plot", plotOutput("pcaplot",width = "550px", height="350px")),
tabPanel("Heatmap",plotOutput("hplot",width = "550px", height="350px")),
tabPanel("Manhattan plot", plotOutput("mplot"))
)
)))
server <- function(input, output,session) {
observe({
input$gender1
updateSelectizeInput(session, 'gender2',choices = genders[genders != input$gender1],options = list(
placeholder = 'Sample 2',
onInitialize = I('function() { this.setValue(""); }')))
})
observeEvent(input$button,{output$table <- renderTable({isolate(fitData(input$gender1,input$gender2))})
output$download <- downloadHandler(
filename = function(){paste(input$gender1,inputSamples,".csv",sep = ' with ')},
content = function(file){
write.csv(fittable(),file)})
shinyApp(ui = ui, server = server)
解决方案
尝试这个
tabPanel("Table",
fluidRow(column(10,tableOutput("table")),
column(3, style = "margin-top: 500px;",
downloadButton("download", "Download",
style="color: #fff; background-color: green; border-color: Black;"))
)),
您应该将边距更改为表格输出的高度。我给了500px。
推荐阅读
- html - 响应式图片元素从 srcset 下载正确尺寸的图片
- font-awesome-5 - 使用 library.add() 时显示备用 Font Awesome 图标的问题
- react-native - 在 React Native 中使用 useState AND map() 刷新容器/屏幕
- r - ggplot2:有条件地改变线型和颜色
- flutter - 如何通过 onTap() 从 ListView.Builder 中删除项目{}
- java - HttpSession setMaxInactiveInterval 不完全工作时间已设置
- django - 我的 Django 应用程序中的相关名称问题
- android - Android Firebase 从多个节点检索数据作为列表
- python - 无法使用 python 连接器将数据插入 maria db
- r - sparklyr 使用 stringr 改变行为