hello,
i'd like to be able to pass the table options as arguments in my ui.R file - the specific use case is to create a customized dataTableOutput function with customized options and styling.
the code from DT package looks like this:
dataTableOutput = function(outputId, width = '100%', height = 'auto') { |
| htmltools::attachDependencies( |
| htmlwidgets::shinyWidgetOutput( |
| outputId, 'datatables', width, height, package = 'DT' |
| ), |
| crosstalk::crosstalkLibs(), |
| append = TRUE |
| ) |
| } |
i want be able to add the options argument here to dataTableOutput, as opposed to adding options through the server logic:
library(shiny)
library(DT)
ui = fluidPage(fluidRow(column(12,DT::dataTableOutput('tbl'))))
server = function(input, output) {
output$tbl <- DT::renderDataTable(iris},
options = list(lengthChange = FALSE)) }
shinyApp(ui,server)
how can i modify the dataTableOutput function to make it get the table options as an argument? should the change be made to
htmlwidgets::shinyWidgetOutput, or to the
datatable one?
any help would be greatly appreciated, thanks!