Skip to content

onClick: Missing values (NA) return different values in numeric vs other column types #261

@daattali

Description

@daattali

See the example below:

df <- data.frame(
  numeric = as.numeric(c(1, NA)),
  logical = as.logical(c(1, NA)),
  character = as.character(c(1, NA)),
  factor = as.factor(c(1, NA))
)
reactable::reactable(
  df,
  defaultColDef = reactable::colDef(
    na = "–"
  ),
  onClick = reactable::JS("
        function(rowInfo, column) {
          alert(rowInfo.row[column.name]);
        }"
  )
)

Clicking on the missing value in the first column will say "NA", whereas in the other columns it'll say "null". This is problematic because in order to differentiate true NA from the string "NA" we need to look at the column type. It would be better if "null" was always returned.

{reactable} v 0.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions