From 51eb46b1ea061b44de69e407ca01a159a7fe2d24 Mon Sep 17 00:00:00 2001
From: Cedric Midoux <cedric.midoux@inra.fr>
Date: Tue, 16 Oct 2018 10:44:29 +0200
Subject: [PATCH] table options

---
 server.R | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/server.R b/server.R
index 8c666bb..eac2c69 100644
--- a/server.R
+++ b/server.R
@@ -1,4 +1,5 @@
 library(shinydashboard)
+library(dplyr)
 library(glue)
 
 shinyServer
@@ -222,18 +223,34 @@ shinyServer
     Glom <- tax_glom(data16S(), input$glomRank)
     taxTableGlom <- Glom %>%
       tax_table() %>%
-      as.data.frame() %>%
+      as.data.frame(stringsAsFactors = FALSE) %>%
       dplyr::select(1:input$glomRank) %>%
       tibble::rownames_to_column()
     otuTableGlom <- Glom %>%
       otu_table() %>%
-      as.data.frame() %>%
+      as.data.frame(stringsAsFactors = FALSE) %>%
       tibble::rownames_to_column()
     joinGlom <-
       dplyr::left_join(taxTableGlom, otuTableGlom, by = "rowname") %>%
       dplyr::select(-rowname)
     return(joinGlom)
-  })
+  },
+  options = list(
+    filter = "top",
+    dom = "lBtip",
+    pageLength = 10,
+    lengthMenu = list(c(10, 25, 50, 100, -1), list('10', '25', '50', '100', 'All')),
+    buttons = list(
+      'colvis',
+      list(
+        extend = 'collection',
+        buttons = c('copy', 'csv', 'excel', 'pdf'),
+        text = 'Download'
+      )
+    ),
+    colReorder = TRUE,
+    scrollX = TRUE
+  ))
   
   output$histUI <- renderUI({
     validate(need(data16S(), ""))
-- 
GitLab