Skip to content

Commit

Permalink
Get DataTables dependency at run-time instead of build-time
Browse files Browse the repository at this point in the history
  • Loading branch information
wch committed Feb 11, 2015
1 parent 664b2b8 commit 138db47
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions 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
#'
Expand Down Expand Up @@ -38,6 +40,6 @@ dataTableDependency <- list(
dataTableOutput <- function(outputId) {
attachDependencies(
div(id = outputId, class="shiny-datatable-output"),
dataTableDependency
dataTableDependency()
)
}

0 comments on commit 138db47

Please sign in to comment.