Skip to content

Commit

Permalink
Add lazyRender to datatables.R
Browse files Browse the repository at this point in the history
  • Loading branch information
Mosk915 authored Nov 25, 2024
1 parent 0287a50 commit c6b9df6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/datatables.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
#' (only display the table body) when the number of total records is less
#' than the page size. Note, it only works on the client-side processing mode
#' and the `pageLength` option should be provided explicitly.
#' @param lazyRender \code{TRUE} to delay rendering until the table becomes visible
#' (the default) or \code{FALSE} to render the table immediately on page load.
#' @param selection the row/column selection mode (single or multiple selection
#' or disable selection) when a table widget is rendered in a Shiny app;
#' alternatively, you can use a list of the form \code{list(mode = 'multiple',
Expand Down Expand Up @@ -207,6 +209,7 @@ datatable = function(
escape = TRUE, style = 'auto', width = NULL, height = NULL, elementId = NULL,
fillContainer = getOption('DT.fillContainer', NULL),
autoHideNavigation = getOption('DT.autoHideNavigation', NULL),
lazyRender = TRUE,
selection = c('multiple', 'single', 'none'), extensions = list(), plugins = NULL,
editable = FALSE
) {
Expand Down Expand Up @@ -375,6 +378,9 @@ datatable = function(
params$autoHideNavigation = autoHideNavigation
}

# record lazyRender
params$lazyRender = lazyRender

params = structure(modifyList(params, list(
data = data, container = as.character(container), options = options,
callback = if (!missing(callback)) JS('function(table) {', callback, '}')
Expand Down

0 comments on commit c6b9df6

Please sign in to comment.