rstudio / pkgs.rstudio.com

https://pkgs.rstudio.com
1 stars 1 forks source link

Consider stretching hyperlinks #11

Open cpsievert opened 3 years ago

cpsievert commented 3 years ago

The hover styles on the table row suggest that the whole row is clickable, but only the hyperlink in the reference column will take you to the website

Screen Shot 2021-05-03 at 11 06 48 AM
cpsievert commented 3 years ago

Might be able to do this with a CSS trick similar to Bootstrap's stretched link https://getbootstrap.com/docs/5.0/helpers/stretched-link/

apreshill commented 3 years ago

this is a reactable table, will need to look into how to do this: https://github.com/tannerlinsley/react-table/issues/206

apreshill commented 3 years ago

Thanks to @jthomasmock I believe this is a possible solution:

tibble(
  x = 1:5,
  y = letters[1:5],
  url = rep("http://www.google.com", 5)
) %>% 
  reactable(
    onClick = JS("function(rowInfo, colInfo, index) {

    window.open(rowInfo.row['url'], '_blank')
    }
    "
  )
  )