在 Shiny R 中移动 DT 底部的页脚

Move the footer at the bottom of a DT in Shiny R

我有一个数据表,其中页脚有“Previous/Next”文本。目前它与“显示 1 个,共 15 个”文本重叠。有没有办法移动它,这样我就不会超车?

这里有图片和代码。我对 html/java 脚本不是很熟悉,所以如果您能提供一个答案来解释您使用特定代码的原因,我们将不胜感激

library(shiny)
library(bs4Dash)
library(DT)


x = data.frame(one = rep("Hey how is everyones day? I need some help on this shiny application and learn how to use some of the features on datatable.", 10),
               two = rep("this is the second column of text. ", 10),
               three = rep("this is the third column of text", 10))


    ui = bs4DashPage(
        old_school = FALSE,
        sidebar_min = TRUE,
        sidebar_collapsed = FALSE,
        controlbar_collapsed = FALSE,
        controlbar_overlay = TRUE,
        title = "Basic Dashboard",
        navbar = bs4DashNavbar(),
        sidebar = bs4DashSidebar(),
        controlbar = bs4DashControlbar(),
        footer = bs4DashFooter(),
        body = bs4DashBody(
            DTOutput("table")
        )
    )
    
    server = function(input, output) {
        
        output$table = renderDataTable({
            datatable(x, rownames = F, style = "bootstrap",  extensions = 'Responsive', options = list(
                #dom = 't'
            ))
        })
    }


shinyApp(ui, server)

当我 运行 在闪亮的仪表板上使用相同的代码时,它会以我希望的方式出现。所以我相信这与 Bs4Dash 样式有关 sheet。以下是 shinydashboard

的外观

你可以试试这个,希望它能解决你的问题。

library(shiny)
library(bs4Dash)
library(DT)


x = data.frame(one = rep("Hey how is everyones day? I need some help on this shiny application and learn how to use some of the features on datatable.", 10),
               two = rep("this is the second column of text. ", 10),
               three = rep("this is the third column of text", 10))


ui = bs4DashPage(
  old_school = FALSE,
  sidebar_min = TRUE,
  sidebar_collapsed = FALSE,
  controlbar_collapsed = FALSE,
  controlbar_overlay = TRUE,
  title = "Basic Dashboard",
  navbar = bs4DashNavbar(),
  #sidebar = bs4DashSidebar(),
  controlbar = bs4DashControlbar(),
  footer = bs4DashFooter(),
  body = bs4DashBody(
    DTOutput("table")
  )
)

server = function(input, output) {
  
  output$table = renderDataTable({
    datatable(x, rownames = F,   extensions = 'Responsive', options = list(
      #dom = 't'
    ))
  })
}


shinyApp(ui, server)

我只从 renderDataTable 中删除了 style = "bootstrap" 并且达到了目的

您需要在初始化后重新绘制 table。

$('#tableIdHere').DataTable().draw();

您的 css 被其他一些默认值 css 覆盖。请检查您的 类 是否具有相似的命名或相互冲突。