Reputation: 529
I am trying to create a datatable in shiny. This solution has been working previously but I must have altered something for it to not anymore:
output$ltl_tbl <- renderDataTable({
input$refresh
ltl_view <- car()
colnames(ltl_view) <- c('Carrier', 'Volume', 'CWT', 'On Time')
DT::datatable(ltl_view,
options = list(lengthMenu = c(10, 25, 50),
pageLength = 10,
orderClasses = TRUE,
fillContainer = TRUE,
searching = FALSE),
rownames = FALSE
) %>%
formatCurrency(3, '$') %>% formatPercentage(4, 0) %>% formatCurrency(2, '', digits= 0)
})
I am just calling a dataframe from a reactive function, changing the column names, then creating the datatable with some options but this is not working and I cannot figure out why.
When I remove the column format (formatCurrency & formatPercentage) and also remove the lines above the actual datatable (e.g., changing column names and dataframe assignment), it will render the datatable in my shinyapp.
Upvotes: 2
Views: 1495
Reputation: 529
Figured it out. I must have added another package that made the call ambiguous. By adding the following in the user interface and server side, it worked.
DT::renderDataTable
DT::dataTableOutput
Upvotes: 2