使用闪亮的按钮扩展名保存pdf中的所有列

时间:2017-12-29 12:18:46

标签: r button shiny

我已阅读了很多帖子,但仍未找到解决方案。 我的按钮扩展只下载了PDF中的一半列,在应用程序中我看到了所有这些列。我该怎么改变它?

这就是我的应用的样子: this is how my app looks like:

以下是用pdf打印的方式: and here is how it is printed in pdf

我的服务器代码.R负责创建数据表:

output$results <- DT::renderDataTable({ 
      DT::datatable(final, extensions =c ('ColReorder', 'Buttons', 'FixedHeader'),class = 'cell-border stripe', rownames = T,
                    caption = ' ',
                    colnames = c('Usługi fryzjerskie' = 5, 'Usługi kosmetyczne' = 6,'Usługi manicure' = 7,'Usługi depilacja' = 8,
                                 'Kolor' = 9,'Sprzedaż fryzjerska' = 10,'Sprzedaż kosmetyków' = 11,'Kuracje damskie' = 12,'Kuracje meskie' = 13,
                                 'Liczba klientów' = 14,'Liczba kobiet' = 15,'Liczba mężczyzn' = 16,'Średni paragon kliencki' = 17,
                                 'Paragon męski' = 18,'Paragon damski' = 19) ,       
                    options = list(
                      fixedHeader = TRUE,
                      columnDefs = list(list(className = 'dt-right', targets = "_all")),   
                      dom = 'Blfrtip',   
                      buttons = 
                        list( 'copy', 'print', list(
                          extend = 'collection',
                          buttons = c('csv', 'excel','pdf'),
                          text = 'Download'
                        )),
                      orderClasses = TRUE,
                      scrollX = TRUE,
                      pageLength = 20,
                      colReorder = TRUE,
                      initComplete = JS(
                        "function(settings, json) {",
                        "$(this.api().table().header()).css({'background-color': '#20B2AA', 'color': '#fff'});",
                        "}")
                    ))
      })  #output

这是ui.R:

library(shiny)


shinyUI(fluidPage( 

  tags$head(
    tags$style(HTML("
                    @import url('//fonts.googleapis.com/css?family=Anton');

                    h2 {
                    font-family: 'Anton';
                    font-weight: 600;
                    line-height: 1.3;
                    color: #483D8B;
                    }

                    "))
    ),


  titlePanel("ZAMOWIENIE 1 v 2"),

  sidebarLayout(

    sidebarPanel( tags$head(
      tags$style(type="text/css", ".well { max-width: 180px; }"),
      tags$style(type="text/css", ".col-sm-4 { width: 10%;}"),
      tags$style(type="text/css", "#last_month { background-color: #DCDCDC; }") ,
      tags$style(type="text/css", ".control-label { line-height: 2 }") 


       ),


                 actionButton("get_data", "Run report"),
                 actionButton("last_month", "Last month"),
                 dateInput('start_date', "Start date", format(Sys.Date()-1, "%Y-%m-01")),
                 dateInput('end_date', "End date",  format(Sys.Date()-1, "%Y-%m-%d"))


  ),


  mainPanel(tags$head(
    tags$style(type="text/css", ".col-sm-8 { width: 89%; }")
    ),
    fluidRow(
      column(   div(DT::dataTableOutput("results"), style = "font-size:80%"), width = 12)
    ),


    tabsetPanel(
      tabPanel(
               HTML('<footer>
                   <h6> kontakt:  Krzysztof Fronczak k.fronczak@partner.samsung.com  </h6>
                    </footer>')

      ))





    )
  )
))

0 个答案:

没有答案