1

私の光沢のあるアプリでは、展開可能な行を持つテーブル (反応可能) を表示します。特定の単語の背景色を変更したいので、html スパンを使用します。通常の行、展開可能な行のテキストでは正常に機能しますが、プレーンな HTML コードのみが表示されます。

ここに画像の説明を入力

両方の列に設定html = TRUEしましたが、正しく表示されません。どうすれば機能しますか?

app.R

library(shiny)
library(htmltools)
library(reactable)

ui <- fluidPage(
  reactableOutput("table")
)
server <- function(input, output) {
  
  output$table <- renderReactable({
    df = data.frame("title" = c("This is the <span style='background-color:yellow;'>Title</span>", "This is a longer Title"), 
                    "abstract" = c("This is the <span style='background-color:yellow;'>abstract</span>", "This is an even longer abstract"))
    reactable(
      df,
      columns = list(
        abstract = colDef(show = F, html = TRUE),
        title = colDef( html = TRUE)
      ),
      details = function(index) {
        htmltools::div(style= "background-color:white",
                       htmltools::tags$div(style= "background-color:#eee; padding: .9em; border-color: #ffe;", df[index, "abstract"])
                       
        )
      }
    )
  })
  
}
4

1 に答える 1