R DT:datatable 移除 .no-footer border-bottom

R DT:datatable remove .no-footer border-bottom

正在尝试从 R 中的 DT:datatable 中删除页脚边框

查看此datatable,我发现以下代码消除了列名(为空“”)和数据之间的边框(以红色表示):

  headerCallback <- c(
    "function(thead, data, start, end, display){",
    "  $('th', thead).css('border-bottom', 'none');",
    "}"
  ),
DT::datatable(
      data = myData(),
      class = "compact",
      rownames = FALSE,
      colnames = c("",""),
      caption = tags$caption(myTitle, style = "color:black"),
      options = list(
        dom = 't',
        ordering = FALSE,
        paging = FALSE,
        searching = FALSE,
        headerCallback = JS(headerCallback)
      )
    )

  })

我现在要做的是消除图像底部的黑线。我发现以下链接似乎是我正在寻找的内容,但现在确定如何将它们合并到我所拥有的内容中:

How To Remove Black Lines

当我检查网页上的元素并展开 <table> 时,我可以取消选中 this box,这会删除底部的黑线并提供我想要的内容。但是,不确定如何将其写入我现有的或新的回调函数。

你可以这样做:

datatable(
  data = iris[1:5,1:2],
  class = "compact",
  rownames = FALSE,
  colnames = c("",""),
  callback = JS("$('table.dataTable.no-footer').css('border-bottom', 'none');"),
  options = list(
    dom = 't',
    ordering = FALSE,
    paging = FALSE,
    searching = FALSE,
    headerCallback = JS(headerCallback)
  )
)