【发布时间】:2018-12-11 13:25:58
【问题描述】:
我有一个如下所示的应用程序:enter image description here
我想在该时间段内将数据表下载为 pdf。但是当我这样做时,只有表导出。 enter image description here
这里是ma ui.R代码:
library(shiny)
jscode <- "shinyjs.closeWindow = function() { window.close(); }"
shinyUI(fluidPage(
tags$head(
tags$style(HTML("
@import url('//fonts.googleapis.com/css?family=Anton');
h2 {
font-family: 'Anton';
font-weight: 600;
line-height: 0.7;
color: #483D8B;
}
"))
),
titlePanel("ZESTAWIENIE 1 v 2"),
sidebarLayout(
sidebarPanel( tags$head(
tags$style(type="text/css", ".well { width: 150px; }"),
tags$style(type="text/css", ".col-sm-4 { width: 170px;}"),
# tags$style(type="text/css", "#close {font-size: 12px; background-color: #e6e6e6; }") ,
tags$style(type="text/css", "#get_data { font-size: 12px; background-color: #e6e6e6;}") ,
tags$style(type="text/css", "#last_month { font-size: 12px;background-color: #e6e6e6; }") ,
tags$style(type="text/css", ".control-label { line-height: 2 ; font-size: 12px; }") ,
tags$style(type="text/css", "#text { width: 390px ; font-size: 11px } "),
tags$style(type="text/css", "#DataTables_Table_0 td[text*='SAL']{ background:#DCDCDC; }")
),
# actionButton("close", "Zamknij raport" ,width = '100%' ),
actionButton("get_data", "Generuj report" ,width = '100%' ),
actionButton("last_month", "Ostatni miesiÄ…c", width = '100%' ),
dateInput('start_date', "Data poczÄ…tkowa", min = '2017-11-01', value= format(Sys.Date()-1, "%Y-%m-01")),
dateInput('end_date', "Data końcowa", min = '2017-11-01' ,value= format(Sys.Date()-1, "%Y-%m-%d"))
),
mainPanel(tags$head(
tags$style(type="text/css", ".col-sm-8 { width: 89%; }")
),
div(
verbatimTextOutput("text"), DT::dataTableOutput("results"), style = "font-size:80%" ),
tabsetPanel(
tabPanel(
HTML('<footer>
<h6> kontakt: kk </h6>
</footer>')
))
)
)
))
我应该把verbatimTextOutput("text") 放在哪里,它负责在下载后显示日期范围以具有该日期?
【问题讨论】:
标签: r pdf datatable shiny download