Hope you are doing great today.
I have an issue trying to make some columns sticky. Here is a piece of code that highlights the error I get: Error in colDef: unused argument (sticky = "left")
Not sure what I am doing wrong, or if there is an issue with aggregation and sticky columns.
Using:
- reactable 0.3,
- $platform [1]: "x86_64-apple-darwin17.0",
- $version.string: "R version 4.2.0 (2022-04-22)".
Reproducible example:
library(shiny)
library(reactable)
library(tidyverse)
ui <- fluidPage(
titlePanel("Test sticky column"),
mainPanel(
reactableOutput("reactTop10")
)
)
server <- function(input, output) {
data<-reactive({
data.frame(Business.Name = c("Shop1","Shop2","Shop1","Shop2"),
Method.Name = c("m1","m1","m2","m2"),
Margin = c(25,32,43,12))
})
output$reactTop10 <- renderReactable({
sticky_style <- list(backgroundColor = "#f7f7f7")
expr = reactable(
data(),
defaultColDef = colDef(
footer = function(values, name) {
htmltools::div(name, style = list(fontWeight = 600))
}
),
rowStyle = JS("function(rowInfo) {
if (rowInfo.aggregated == true) {
return { fontWeight: 'bold' }
}
}"),
groupBy = c("Business.Name",
"Method.Name"),
columns = list(
Business.Name = colDef(style = list(fontWeight = 600),
sticky = "left",
headerStyle = list(borderRight = "1px solid #eee"),
header = with_tooltip("Business.Name", "Names of our top 10 merchants")),
Method.Name = colDef(aggregate = "unique",
header = with_tooltip("Method.Name",
"Name of the method bla bla")),
Margin = colDef(aggregate = "mean",
header = with_tooltip("Margin",
"Name of the premium services"))
))
})
}
# Run the application
shinyApp(ui = ui, server = server)