From bca0d5b48b17ee3988bddc8eef06c99ac7ed2dbe Mon Sep 17 00:00:00 2001 From: Ashley Baldry Date: Wed, 15 Nov 2023 13:14:38 +0000 Subject: [PATCH] Enable sorting for ColReorder by default --- R/datatables.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/datatables.R b/R/datatables.R index 00f517cf..30e89033 100644 --- a/R/datatables.R +++ b/R/datatables.R @@ -257,6 +257,10 @@ datatable = function( if (is.null(options[['autoWidth']])) options$autoWidth = FALSE # disable CSS classes for ordered columns if (is.null(options[['orderClasses']])) options$orderClasses = FALSE + # enable column names for column reordering by default + if (is.null(options[['columns']])) { + options$columns = lapply(names(data), function(e) list(name = e)) + } cn = base::colnames(data) if (missing(colnames)) {