Skip to content

Applying parameters with col_param #18

@zykezero

Description

@zykezero

edit: I was able to get around the first issue about colWidths, by being more specific in assigning colWidths earlier in the initialization. Whats interesting now is that the filters do not consistently align with the columns.

Hello,

If you could help me understand how your col_param works please. I am trying to pass parameters to different groups of columns, when I pass colWidths to a group of columns they receive the width but all other columns are set to whats seems to be 0.

I just inserted the issue into your demo code.

shinyApp(
  ui = fluidPage(
    dq_handsontable_output("randomTable", 9L)
  ),
  server = function(input, output, session) {
    hw <- c("Hello", "my", "funny", "world!")
    data <- data.frame(A = rep(hw, 500), B = hw[c(2,3,4,1)],
      C = 1:500, D = Sys.Date() - 0:499, stringsAsFactors = FALSE)
    
   dq_render_handsontable(
    "randomTable",
    data = data,
    width_align = TRUE,
    filters = c("Select"),
    table_param =
      list(
        height = 800,
        readOnly = TRUE,
        stretchH = "all",
        highlightCol = TRUE,
        highlightRow = TRUE
      ),
    col_param =
      list(list(col = c("A", "B"), readOnly = FALSE),
           list(col = c("C", "D"), colWidths = 300)
      ),
    horizontal_scroll = TRUE
   )
  }
)

I thought it would work how you would pass multiple hot_cols.
ex:

hot_col(
  c(
    "A",
    "B"
  ),
  readOnly = FALSE
) %>%
hot_col(
  c(
    "C",
    "D"
  ),
  colWidths = 300
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions