From 138db47e6bef195f14f6a14f4289ca445e9b2efa Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Tue, 10 Feb 2015 21:07:27 -0600 Subject: [PATCH] Get DataTables dependency at run-time instead of build-time --- R/output-datatable.R | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/R/output-datatable.R b/R/output-datatable.R index 0108e92..3020d75 100644 --- a/R/output-datatable.R +++ b/R/output-datatable.R @@ -1,16 +1,18 @@ -dataTableDependency <- list( - htmlDependency( - "datatables", "1.10.2", - c(file = system.file("www/datatables", package = "shinybootstrap2")), - script = "js/jquery.dataTables.min.js" - ), - htmlDependency( - "datatables-bootstrap", "1.10.2", - c(file = system.file("www/datatables", package = "shinybootstrap2")), - stylesheet = c("css/dataTables.bootstrap.css", "css/dataTables.extra.css"), - script = "js/dataTables.bootstrap.js" +dataTableDependency <- function() { + list( + htmlDependency( + "datatables", "1.10.2", + c(file = system.file("www/datatables", package = "shinybootstrap2")), + script = "js/jquery.dataTables.min.js" + ), + htmlDependency( + "datatables-bootstrap", "1.10.2", + c(file = system.file("www/datatables", package = "shinybootstrap2")), + stylesheet = c("css/dataTables.bootstrap.css", "css/dataTables.extra.css"), + script = "js/dataTables.bootstrap.js" + ) ) -) +} #' Create a table output element #' @@ -38,6 +40,6 @@ dataTableDependency <- list( dataTableOutput <- function(outputId) { attachDependencies( div(id = outputId, class="shiny-datatable-output"), - dataTableDependency + dataTableDependency() ) }