5

I am using NFL Stadium names in a crosstalk filter_select() function for my r shiny app using a reactable table. However, when I go to select "M&T Bank Stadium", it displays as "M&[amp;]T Bank Stadium" (I have added the brackets so you see what it looks like). Is there a way to have the crosstalk filter_select show "M&T Bank Stadium" and not "M&[amp;]T Bank Stadium?"

I've made a quick MRE below

library(reactable)
library(tidyverse)
library(crosstalk)
library(shiny)

df <- tibble(points = c(10, 12, 14), 
             stadium = c("M&T Bank Stadium", "Wembley Stadium", "FirstBank Stadium"))

df_crosstalk <- SharedData$new(df)

df_react <- 
  reactable(df_crosstalk)

ui <- fluidPage(
  titlePanel("Test Ampersand"),
  fluidRow(
    column(
      4,
      filter_select(
        id = "stadium",
        label = "Stadium",
        sharedData = df_crosstalk,
        group = ~`stadium`)
      ),
    column(
      8,
      df_react
    )
  )
)

server <- function(input, output, session) {
  output$table <- renderReactable({
    df_react
  })
}

shinyApp(ui, server)
m0nhawk
  • 22,980
  • 9
  • 45
  • 73
  • 1
    I'm not sure it's possible, from the source code for [filter_select](https://github.com/rstudio/crosstalk/blob/8128ef3be2a5c79e3818e5df20da4c2bb4b69503/R/controls.R#L153), it uses JSON to send the data, and the `&` presented in the JSON itself. – m0nhawk Jan 07 '23 at 06:56
  • 1
    also look in `df_crosstalk$data(withSelection = F, withFilter = F, withKey = T)`, which is used inside `filter_select`, it gives: `"M\\&T Bank Stadium"` for the first row – Remko Duursma Jan 09 '23 at 12:53
  • 1
    you should probably report this as a bug on the `crosstalk` github – Remko Duursma Jan 09 '23 at 12:54
  • thanks @RemkoDuursma! There was actually an open thread for this exact issue on the `crosstalk` GitHub with no response, so I just added this MRE over to that thread. Really appreciate the help and guidance! – Paul Kearney Jan 10 '23 at 15:46

1 Answers1

0

For anyone with the same problem, this has been fixed here: github.com/rstudio/crosstalk/issues/87